IOS设备支持多个方向旋转
来源:互联网 发布:vb集成开发环境ppt 编辑:程序博客网 时间:2024/05/09 16:03
- IOS设备中的加速计可以确定设备的当前方向。默认情况,一个应用程序支持纵向和横向。当设备方向改变的时候,系统会发送UIDeviceOrientationDidChangeNotification通知,默认情况下UIKit框架监听这个通知,并自动更新这个方向。
- 四个方向如下图
- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientation:) name:UIDeviceOrientationDidChangeNotification object:nil];}#pragma mark - Rotation-(void) deviceOrientation:(NSNotification *)notification{ // NSLog(@"notification :%@",[notification userInfo]); // NSLog(@"notification :%@",[notification object]); UIDevice *device=(UIdevice *)[[notification object]]; NSLog(@"device :%d",device.orientation);}
也可以这样:
#pragma mark - Rotation-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ NSLog(@"duration :%f",duration); UIView *button =[self.view viewWithTag:101]; if (toInterfaceOrientation==UIInterfaceOrientationPortrait) { button.frame=CGRectMake(320/2-140/2, 80, 140, 40); } else { button.frame=CGRectMake(480/2-140/2, 80, 140, 40); }}
0 0
- IOS设备支持多个方向旋转
- iOS判断当前设备旋转方向
- iOS扩展navgation,支持锁定旋转方向
- 如何让ios iphone设备支持旋转?
- iOS设备旋转支持横屏
- ios开发屏幕旋转锁定时判断设备的方向
- 81 设备支持方向
- 关于iOS app的设备方向支持的问题
- ios动画旋转方向
- iOS 的Viewcontroller只支持一个屏幕方向,弹出不同方向,旋转
- 让android程序根据重力感应旋转屏幕(支持4个方向旋转)
- 让android程序根据重力感应旋转屏幕(支持4个方向旋转)
- iOS中检测当前设备的旋转方向(关闭屏幕旋转)
- ios6 设备旋转以及获取设备方向
- ios6 设备旋转以及获取设备方向
- ios6设备旋转 以及获取设备方向
- ios 设备方向判断
- 判断ios设备方向。
- java拼接图片
- 使用PHP实现简单Hash表
- less 命令
- UVa:1339 Ancient Cipher
- 继承Ext.data.Model
- IOS设备支持多个方向旋转
- DevExpress.XtraGrid InitNewRow经典 .
- linux 网络配置
- 2013-12-OC新语法小结
- 关于shape的一些属性
- java中复制文件的效率测试
- File:afx.inl Line:122
- android sip协议框架
- 单点登录