When my interface rotates i want to call certain functions. How can I do these actions?
+3
A:
Depending on what you want to do,
Implement some of these methods in your active view controller class:
-willRotateToInterfaceOrientation:duration:-willAnimateRotationToInterfaceOrientation:duration:-didRotateFromInterfaceOrientation:
Or some of these methods in your app delegate:
-application:willChangeStatusBarOrientation:duration:-application:didChangeStatusBarOrientation:
Or listen to some of these local notifications:
- UIApplicationWillChangeStatusBarFrameNotification
- UIApplicationDidChangeStatusBarFrameNotification
- UIApplicationWillChangeStatusBarOrientationNotification
- UIApplicationDidChangeStatusBarOrientationNotification
KennyTM
2010-04-16 12:21:23
+3
A:
You can use this:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(yourMethod:)
name:@"UIDeviceOrientationDidChangeNotification" object:nil];
gammelgul
2010-04-16 12:22:51