我有一个应用程序的所有屏幕的肖像除了一个。在iOS 8中,一个横向页面看起来很好,直到设备向任何方向旋转。视图在一个奇怪的轴上旋转,其部分从屏幕上消失。我尝试过在viewWillTransitionToSize中更新视图的框架,但是它只会导致更多的问题,将子视图的框架更改为超级疯狂。一些解决方案建议这样做:
- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification
{
[UIViewController attemptRotationToDeviceOrientation];
}但这对我没有用。有什么想法吗?谢谢!
发布于 2015-03-27 00:04:02
违规行将位于您的AppDelegate didFinishLaunchingWithOptions函数中,如下所示:
self.window = [UIWindow alloc initWithFrame:[UIScreen mainScreen界]];
发布于 2015-03-27 01:32:33
请尝尝这个。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}这将允许左和右景观(但它不赞成自iOS6)。
或者这个但我不是在测试它。
- (BOOL)shouldAutorotate {
return NO;
}https://stackoverflow.com/questions/29290076
复制相似问题