gpt4 book ai didi

iOS8 方向 : supportedInterfaceOrientations called but no orientation change

转载 作者:行者123 更新时间:2023-11-29 02:18:09 24 4
gpt4 key购买 nike

我有一个导航 Controller :

    //=========================
- (BOOL)shouldAutorotate;
{
return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
NSLog(@"Nav: supported Orientation");
if ([[self topViewController] respondsToSelector:@selector(supportedInterfaceOrientations)])

else
return [super supportedInterfaceOrientations];
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[self.topViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[self.topViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}

我的 ROOTCTRL 有:

//=========================
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}

-(BOOL)shouldAutorotate
{
return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
NSString *risp;
switch (self.interfaceOrientation) {
case UIInterfaceOrientationLandscapeLeft:
risp = @"LAND_LEFT";
break;
case UIInterfaceOrientationLandscapeRight:
risp = @"LAND_RIGHT";
break;
case UIInterfaceOrientationPortrait:
risp = @"PORT";
break;
case UIInterfaceOrientationPortraitUpsideDown:
risp = @"PORT_UPsideDOWN";
break;
case UIInterfaceOrientationUnknown:
risp = @"UNKNOW";
break;
default:
break;
}
NSLog(@"HOME didRotate:%@",risp);
}

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{

}
UINavigationController的

supportedInterfaceOrientations总是被调用,Home Controller 的supportedInterfaceOrientations也总是被调用;但主页不会从横向左旋转到横向右,反之亦然:

因此,Home ctrl 在启动时具有正确的方向,但如果设备旋转了 Home Controller ,则永远不会旋转...它仅调用supportedInterfaceOrientations 方法(导航 Controller 和根 Controller ),没有任何效果...

我做错了什么??

最佳答案

如果在 iOS8 上运行并且您的代码在 iOS8 之前就已经存在,请检查以下答案。删除您的应用委托(delegate)中提到的行(如果它存在并且应该开始工作)。

UISplitViewController rotation iOS8 not working as expected

关于iOS8 方向 : supportedInterfaceOrientations called but no orientation change,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28498473/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com