ios开发-判断手机方向改变
2014-01-26 16:00
531 查看
ios开发-判断手机反转--个人学习之路的总结。
//监听手机方向改变事件
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged)
name:UIDeviceOrientationDidChangeNotification
object:nil];
//处理函数
-(void) orientationChanged
{
switch ([[UIDevice currentDevice]orientation]) {
case UIDeviceOrientationPortrait:
NSLog(@"portrait");
break;
case UIDeviceOrientationPortraitUpsideDown:
NSLog(@"portraitUpSideDown");
break;
case UIDeviceOrientationLandscapeLeft:
NSLog(@"landscapeLeft");
break;
case UIDeviceOrientationLandscapeRight:
NSLog(@"landscapeRight");
break;
case UIDeviceOrientationFaceDown:
NSLog(@"facedown!!");
break;
case UIDeviceOrientationFaceUp:
NSLog(@"FaceUp");
break;
default:
break;
}
}
//监听手机方向改变事件
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged)
name:UIDeviceOrientationDidChangeNotification
object:nil];
//处理函数
-(void) orientationChanged
{
switch ([[UIDevice currentDevice]orientation]) {
case UIDeviceOrientationPortrait:
NSLog(@"portrait");
break;
case UIDeviceOrientationPortraitUpsideDown:
NSLog(@"portraitUpSideDown");
break;
case UIDeviceOrientationLandscapeLeft:
NSLog(@"landscapeLeft");
break;
case UIDeviceOrientationLandscapeRight:
NSLog(@"landscapeRight");
break;
case UIDeviceOrientationFaceDown:
NSLog(@"facedown!!");
break;
case UIDeviceOrientationFaceUp:
NSLog(@"FaceUp");
break;
default:
break;
}
}
相关文章推荐
- iOS开发 - 渐变导航条升级版(判断滚动的方向和改变方向时的位置)
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制
- iOS开发之UITableView , UICollectionView, UIScrollview,根据代理判断页面滚动方向。
- iOS开发 - 如何获取设备的总容量和可用容量 网络运营商 3g/wifi判断 手机型号
- ios开发过程中屏幕方向判断的问题
- iOS 开发判断手机型号
- iOS开发支付宝支付,如何判断手机上面是否有安装支付宝软件
- iOS开发 - ScrollView滚动时怎么判断滚动停止及滚动的方向
- IOS开发——判断屏幕的方向
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制
- IOS开发 - 判断手机号码是否符合规则
- ios开发过程中屏幕方向判断的问题
- iOS开发——判断手机格式
- [ios开发]判断手机设置语言是否为中文(简体或者繁体)
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制
- iOS开发 根据正则表达式谓词(NSPredicate)判断邮箱,手机号码,身份证...
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制
- iOS开发中手机号码和价格金额有效性判断及特殊字符的限制