guys. I have such problem: I need to use full screen for my view. So I use
[_activityIndicator setFrame:[[UIScreen mainScreen] applicationFrame]];
It's work perfect, but only in portrait view. What to do if my app have to work in landscape too?
Your app has a root view controller, which rotates in response to device rotation. So set your frame in terms of the root view controller's view. Use its bounds, not its frame.
You can get a reference to the root view controller through the main window. You can get a reference to the main window through the shared application:
UIWindow* theWindow = [[UIApplication sharedApplication] keyWindow];
UIViewController* rvc = theWindow.rootViewController;
UIView* mainView = rvc.view;
UIActivityIndicatorView* act =
[[UIActivityIndicatorView alloc] initWithFrame: mainView.bounds];
[mainView addSubview: act];
And then you retain a reference to the activity indicator in a property and set it spinning.