gpt4 book ai didi

objective-c - 强制 UIViewController 处于横向模式 iOS7

转载 作者:搜寻专家 更新时间:2023-10-30 19:57:43 24 4
gpt4 key购买 nike

我已经实现了正确的功能,但它们没有被触发?我已经在 StackOverFlow 上尝试了几种解决方案,但都没有用。我已经尝试将 View 添加到 UINavigationController,但也不起作用。

FakeIDDetailViewController.h:

@interface FakeIDDetailViewController : UIViewController
@end

FakeIDDetailViewController.m:

@interface FakeIDDetailViewController ()

-(BOOL)shouldAutorotate
{
return NO;
}

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

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeLeft;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return UIInterfaceOrientationLandscapeLeft;
}

最佳答案

如果您将 View Controller 推送到导航 Controller 中的其他 View Controller 堆栈,则仅要求横向不会很好地工作。您应该以模态方式显示横向约束 View Controller 。

请在此处查看我的示例项目答案: https://stackoverflow.com/a/16022631/983912

关于objective-c - 强制 UIViewController 处于横向模式 iOS7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21615848/

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