Search code examples
objective-ciosios5uiwebviewrefresh

Refresh a UIWebView


I'm looking for a simple way of adding a refresh mechanism to my UIWebView. I've seen posts about the EGO pull to refresh but, to be honest, I don't understand how that works, especially since I have no clue on how to use it with a UIWebView instead of a table view. And it seems to me like a lot of overhead for just a simple refresh.

I thought about adding a navbar but instead of a back button, add a custom "refresh" one. But based on what I've found so far, it seems as complicated as the other solution.

So, basically, I'd like to know what you would do. Keep in mind that the only requirement is that the user have some easy way of refreshing the view. Any suggestion ?

*I'm a begginer in Objective-C so that is why I don't understand how to plug the EGO framework with a UIWebView even after downloading and running the code.


Solution

  • Well,

    Create a button and inside button's IBAction,

    - (IBAction) performReload:(id) sender {
        [self.uiwebview reload];
    }
    

    Check the documentation, it will help you a lot at your beginning stage.

    Visual Suggestion:

    enter image description here http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html