[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receivedRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
step 2: remove a notification
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIDeviceOrientationDidChangeNotification
object:nil];
step 3: implement "receiveRotate"
- (void)receivedRotate:(NSNotification*)notification
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (deviceOrientation == UIDeviceOrientationPortrait)
{
...
}
}
沒有留言:
張貼留言