繁体   English   中英

iOS 8中的旋转

[英]The Rotation in iOS 8

我刚刚升级到Xcode 6,在iPhone 6(ios8)中运行我的应用程序时,屏幕有时无法旋转。 这个问题是不是在IOS 7我搜索在互联网上发生,看到willRotateToInterfaceOrientation在IOS 8.目前我的代码实现此功能过时,如果我有新的funcion更换viewWillTransitionToSize ,应用程序上运行ios7不会影响?

我可以按如下方式调用willRotateToInterfaceOrientation

[self willRotateToInterfaceOrientation:interfaceOrientation duration:0.0];

但是我不知道如何调用viewWillTransitionToSize

[self viewWillTransitionToSize:<#(CGSize)#> withTransitionCoordinator:<#(id<UIViewControllerTransitionCoordinator>)#>]

我应该在此函数中发送CGSizeUIViewControllerTransitionCoordinator吗? 请帮我。 提前致谢。

希望您在“项目”->“常规”选项卡中设置了以下项目。 在此处输入图片说明

然后你给这个

-(BOOL)shouldAutorotate {
   return YES;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
   return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
   return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortrait |UIInterfaceOrientationMaskPortraitUpsideDown;
    //or simply UIInterfaceOrientationMaskAll;
}

快乐编码:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM