Brad Cypert
Brad Cypert

Reputation: 679

How can I use UIActivityViewIndicator in my app delegate?

I've got a method that is in my app delegate that is called to pull information from a web server. Is there a way to easily incorporate UIActivityViewIndicators into the app delegate? Everything I've found so far online shows the Indicator requiring to be added as a subview. Is this doable? If so, can you point me in the right direction on where to find this?

[edit] I'm using a storyboard instead of xibs.

Upvotes: 2

Views: 3680

Answers (2)

user812954
user812954

Reputation: 4391

Yes, you can add the UIActivityIndicatorView directly from your AppDelegate. There should be an object or property of your UIViewController inside your AppDelegate. There, you can add it.

[viewController.view addSubView:activityIndicatorView];

Upvotes: 0

Eyal
Eyal

Reputation: 10828

You can easily add a UIActivityViewIndicators with few lines of code:

UIActivityIndicatorView *aiv = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];  
aiv.center = self.window.rootViewController.view.center;
[self.window.rootViewController.view addSubview:aiv];
[aiv startAnimating]; 

But there are a lot of open source project like MBProgressHUD that gives you more stylish indicator, with other additions..

Upvotes: 12

Related Questions