成都创新互联网站制作重庆分公司

ios屏幕旋转-创新互联

手机屏幕旋转时,试图控制器可以相应一些方法,可以再这些方法里自己布局视图

我们提供的服务有:成都做网站、成都网站设计、成都外贸网站建设、微信公众号开发、网站优化、网站认证、东昌府ssl等。为上1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的东昌府网站制作公司

旋转方向的枚举类型

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__);

}

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享标题:ios屏幕旋转-创新互联
新闻来源:http://cxhlcq.com/article/disdse.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部