Can I load new url in UIWebView with push like animation

I'd like to load a url in a UIWebView. Then when a user clicks a button on the HTML page, I use the shouldStartLoadWithRequest method on the UIWebView to intercept the click and tell the UIWebView to load the new url but re-animate the same instance of the UIWebVIew like it was a new UIWebView being pushed on the stack. Also, I'd like to hook up the back button functionality to basically do the reverse of this.

Is this possible?

Answers


I think, that you have no options to use only one UIWebView in this case. In your example they use flip animation, but you want push and your webView have to use more space for this.

You can just use array of webViews, handle webViewDidFinishLoad: and just move them to right.

Also you can just use flip animation.

About hooking up the back button: You have to implement back button by yourself. To implement back button you have to use goBack method of webView.

EDIT: I just understand that you use navigationController to push and pop you webViews. I think that it is a bad practice because users would be confused. We have to use push and pop with navigation controller to navigate between different logical screens. But in that case we just update our content.

I think that it can break HIG. It will be better if you implement you animation less "push/pop navigation". And now I think it will be better to use another type of animation. It's harder but less complicated for user.

But in case you want to use navigationController you can just clean part of navigation stack in didReceiveMemoryWarning method.

And about back button of navigationController. Actually, it's a hard question and answers aren't straightforward: back button callback in navigationController in iOS and Setting action for back button in navigation controller


Need Your Help

How do I find the longest word in a Visual Basic array?

arrays vb.net word

I have an array in Visual Basic that needs to have the longest word returned. How do I go about locating the longest word in a String array? Any help is greatly appreciated!