【发布时间】:2016-02-26 03:48:04
【问题描述】:
谁能告诉我为什么会这样?还有其他需要定义的地方吗?
//AppDelegate
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
//return NO;
}
-(BOOL)shouldAutorotate {
return NO;
}
【问题讨论】:
-
您有评论
//AppDelegate。应用程序委托的supportedInterfaceOrientations从未被调用(其他方法也没有),因此该代码无效。 -
那只是为了显示代码在哪里。但你只是让我看得更远,向我展示了我的错误……对不起,发布了如此愚蠢的错误。我在 AppDelegate 中也有这个 - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{}
-
返回的是 Landscape 而不是 LandscapeRight。谢谢你指出我的愚蠢。谢谢! @马特
-
酷。随意将其发布为您自己问题的答案:在 SO 上完全合法(并鼓励)。你问还有什么地方会对轮换产生影响,你找到了!
标签: ios objective-c xcode7 uiinterfaceorientation