开发者

iOS - UIActivityIndicatorView in a Tab Bar application

I'm just fishing for some hints on how to implement this. I have a Tab Bar application with 3 tabs and each tab loads some data from the internet. My idea is to get the selected tab item title from the delegate method -didSelectViewController:

From there I will check what tab is selected like so and start spinning the UIActivit开发者_JS百科yIndicatorView:

if([viewController.tabBarItem.title isEqualToString:@"Tab 2"]) {

    // Start spinning the UIActivityIndicatorView
    [spinner startAnimation];

    // Download the appropriate data for Tab 2
    NSArray *data = [MyClass getData];

    // Stop spinning the UIActivityIndicatorView
    [spinner stopAnimation];

    // This is the tricky part (at least I think), I need to pass this data on to the ViewController that is setup for Tab 2, how can I do that?

    } else if(...) {
    // ...
}

Have I gotten the concept correct?

Should I use some specific UIActivityIndicatorView like MBProgressHUD or SVProgressHUD? (though I don't want to complicate my application with extra code, and most importantly I want to understand the concept of using the UIActivityIndicatorView)


See Tyler's Answer Here: implementing UIActivityIndicatorView while NSData dataWithContentsOfURL is downloading

I think it fits the bill perfectly for your UIActivityIndicator needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜