Cocoa WebView reloads on first click - objective-c

I have an OS X application with a WebView that reloads the WebView on the first click if the click is not on a link within the view.
Any suggestions of how to hunt this down? I assumed it would have to do with focus, but I thought maybe someone had encountered something like this before.
Thanks, Charlie

Please check in your code somewhere you are loading it manually something like this:-
[[webView mainFrame]loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.google.com"]]];

Related

Writting in a textarea inside a (xcode) WebView, causes the view to being pushed up

Here is the scenario. I'm developing an app for ipad. This app, is just a container for a web site. I created a webview that calls a website which has a textarea.
If I click inside this textarea and the softkeyboard is displayed, the view is pushed up more than the size of the keyboard. I fixed this by using the UIKeyboardWillShowNotification notification to put the view down again.
But check this. If I write inside the textarea, the view is pushed up again, even if is just one letter.
Here are some screenshots:
this is before writting something
this is after writting something
Has somebody had the same issue? Or any clue of what is hapenning?
Ok I figure it out. It was my fault, the cause was that the main view was a TableView. Changed to a simple View and everything is now perfect

pinchable webview

I have a webview, which show a link to a specific website, but the display is fixed, it feels like browsing the web from old style mobile, n not iphone.
Is there a way to make a webview pinchable? Since the webview in my apps is not pinchable, which mean I can't zoom it in or out.
Any help is appreciated.
Thanx in advance.
You need to make sure that scale pages to fit is checked in IB, and that multi-touch & user interaction are enabled.
That worked for me:
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.bounds.frame];
webView.scalesPageToFit=TRUE;

Best way to create floating notification iOS

I've got a tabbed iPad application with just about each tab running a UIWebView. I'm getting all sorts of callbacks, like when a user tries to leave the corporate site (which only displays the company site to users). In this case, I pop up a "toast" style window that tells them to click a button to open the page in Safari. I also pop it up with a spinner and no text to indicate that a page is loading. The approximate look that I'm going for is used in lots of applications, but you can see it best when changing the volume on the iPhone or iPad. It's just a translucent rounded square that fades in and out.
Right now I've got it implemented on one of my tabs, and I did it by creating the objects (a spinner, a label, and a UIImage with the square) and then programmatically hiding and showing them using [UIView beginAnimations] and changing the label's text. It works perfectly but I've got these nagging things hovering over my interface in Xcode, and it takes a lot of setup to accomplish if I wanted it to be in another tab, which I do. I can't help but think that there's a better way to accomplish this. I thought about making and adding a subview, but that would leave a white background to the toast. What I'm thinking is creating some sort of object that I can allocate in a tab's view controller whenever it's needed.
What are your guys ideas, or have you done this in the past? I see it in a lot of prominent applications, like Reeder, so I'm sure it's been done more eloquently than I have done it.
Matt Gallagher has a great class called LoadingView here Showing message over iPhone Keyboard. I use it.
MBProgressHUD is a popular library for this, as well.

Disable all buttons until finished loading?

I have a app where people can delete stuff. I am wanting to disable all my buttons so the user has to wait till the action is done.
I have the setHidesBackButton working, but it looks tacky. I would rather have it just become inactive where if the user taps it, they can't go anywhere.
I have looked into a few things, and wonder what's the best option! (like to replace it with another button).
Please post some code with your answer :)
Thanks in advance,Coulton
Here's what I did: when it was loading, I set the user interaction like this:
self.view.userInteractionEnabled = NO;
Then when it was done, I did this:
self.view.userInteractionEnabled = YES;
Hope I helped some people.
One approach is to put a modal view with user interaction disabled over the whole screen. The view can use transparency to 'dim' the screen and you could add a UIActivityView to this view so the user knows they need to wait for a moment.
If you just want to make the buttons inactive, I've done this before with a transparent view, again set to have user interaction disabled, positioned over the navigation bar.

App should open links with WebView not with Safari

I've got an UITextView in my app where rss feeds are loaded in. Now I want that when there's a link in the textview and you tab on it, my webview should open that link not safari. How can I do this?
Hey,
It will be difficult for you to know where you have clicked in your UITextView.
Honestly the best way for you to do that it to use the Three20 framework.
I don't think this is possible in a UITextView without significant effort.
Just an idea, but could you not load your RSS feed directly into a UIWebView? - (You can display a HTML formatted string in a UIWebView). Subsequent link presses could then by hijacked using the UIWebView delegate and handled by your application to (for example) open them in another UIWebView. Take a look at the UIWebView interface & delegate to see if it might help.
Hope this helps!
Nick.