标签:
如果需要获得UIDeviceOrientation的转换消息的话,只需要:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
在结束时候,需要移除注册的通知(dealloc)
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
- (void)orientationChanged:(NSNotification *)notification { ... }
需要获取设备方向变化(UIDeviceOrientation)的消息
标签:
原文地址:http://www.cnblogs.com/R0SS/p/4858403.html