Improving the Web View 1/4. UIActivityIndicatorView

This tutorial continues on from How to use Open Flow to create a menu, so make sure you get the code. This tutorial is going to show you how to add an UIActivityIndicatorView that is the little gray loading signal.

UIActivityIndicatorView
To begin go to FirstViewController.h and insert the following after the declaration of the UIWebView.

IBOutlet UIActivityIndicatorView *m_activity;
}
@property (nonatomic, retain) UIActivityIndicatorView *m_activity;

In FirstViewController.m right after @implementation FirstViewController insert the following.

@synthesize m_activity;

And then after the init method

- (void)webViewDidFinishLoad:(UIWebView *)webView {
        [m_activity stopAnimating];
        UIApplication* app = [UIApplication sharedApplication];
        app.networkActivityIndicatorVisible = NO;
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
        [m_activity startAnimating];
    UIApplication* app = [UIApplication sharedApplication];
        app.networkActivityIndicatorVisible = YES;
}

Save and then double click on the FirstViewr.xib file.
In the interface builder add an activity indicator to the center of the web view.

Then select Hide when stopped.

If you saved the .h and .m file then under File’s Owner you should see m_activity click the circle and drag it over to the gray activity indicator.

Save and run and you should see the spinning gray indicator when you click one of the menu buttons
code for Improving the web view 1/4

This entry was posted in cocos2d. Bookmark the permalink.

2 Responses to Improving the Web View 1/4. UIActivityIndicatorView

  1. Wilburn says:

    Heya just wanted to give you a quick heads up and let
    you know a few of the images aren’t loading correctly.

    I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and
    both show the same results.

    Look at my weblog; free mobile apps for android 2.3 [Wilburn]

  2. Patti says:

    I read a lot of interesting articles here. Probably you spend a lot of time writing,
    i know how to save you a lot of work, there is an online
    tool that creates high quality, SEO friendly articles in minutes, just
    search in google – laranitas free content source

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>