【发布时间】:2016-04-24 15:30:37
【问题描述】:
我有问题。我在这里解决了这个问题(https://stackoverflow.com/questions/34870418/app-crashes-if-the-orientation-is-changing-in-uiwebview)
但现在我的应用忽略了我的orientation。如果我输入了登录数据并加载了新网站但orientation 不一样,则应用程序将忽略新的orientation。
dispatch_async(dispatch_get_main_queue(), ^{
NSNumber *value = [NSNumber alloc];
NSLog(@"Inside!");
NSLog(@"Orientation: %@", [self orientNr]);
if( [[self orientNr] isEqualToNumber:@1] ) value = [NSNumber numberWithInt:UIInterfaceOrientationUnknown];
else if( [[self orientNr] isEqualToNumber:@2] ) value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
else if( [[self orientNr] isEqualToNumber:@3] ) value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
});
该应用程序正在此块内,因为我在控制台上获得了两个日志。 orientation 是正确的,但它不会执行。
为什么应用忽略了我的orientation?如果我重新启动应用程序,它总是纵向的,尽管它应该是横向的。
编辑:
在我的文件 plist.info 中,我配置了 Supported Interface Orientation
编辑 2:
[3]【问题讨论】:
标签: ios objective-c uiwebview uiinterfaceorientation