NetDeveloper
NetDeveloper

Reputation: 519

Best way to notify UIInterfaceOrientation changes to other viewControllers

I am looking for the best way to notify all the viewControllers of UIInterfaceOrientation changing that is detected in first-viewController added to mainWindow.

Do I have to NSNotification in the controller where these events are detected and other controllers will subscribe to that? Or there is any cleaner way?

Thanks for the help!!!

Upvotes: 1

Views: 3011

Answers (2)

JerryZhou
JerryZhou

Reputation: 5186

Add UIApplicationDidChangeStatusBarOrientationNotification in viewDidLoad which anyView you wanted to notify would be better.

Upvotes: 2

bandejapaisa
bandejapaisa

Reputation: 26972

Your UIViewController already get rotation notification messages:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

and

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

and also

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

Upvotes: 0

Related Questions