您的位置:首页 > 其它

“应用程序配置不正确,程序无法启动”的解决方法资料收集

2015-03-09 10:51 465 查看
手机屏幕旋转时,试图控制器可以相应一些方法,可以再这些方法里自己布局视图

旋转方向的枚举类型typedefNS_ENUM(NSInteger, UIInterfaceOrientation) { UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft};

是否支持旋转- (BOOL)shouldAutorotate{NSLog(@"%s",__FUNCTION__);returnNO;}
在旋转某一个方向时,是否支持旋转
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{NSLog(@"%s",__FUNCTION__);returnNO;}

将要旋转时走的方法,可以判断要转向的方向
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{NSLog(@"%s %f",__FUNCTION__,duration);}

视图将要布局子视图
window调整显示的view controller的bounds,由于view controller的bounds发生变化,将会触发
viewWillLayoutSubviews 方法。

- (void)viewWillLayoutSubviews{NSLog(@"%s",__FUNCTION__);}
视图完成布局子视图- (void)viewDidLayoutSubviews{NSLog(@"%s",__FUNCTION__);}

接着当前view controller的
willAnimateRotationToInterfaceOrientation:duration:
方法将会被调用。系统将会把该方法中执行的所有属性变化放到动animation block中。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{NSLog(@"%s %f",__FUNCTION__,duration);}
旋转完成执行的方法- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{NSLog(@"%s",__FUNCTION__);}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐