iphone – shouldAutorotateToInterfaceOrientation不起作用
我一直以肖像模式写我的通用应用程序,
现在大概有15个nib文件,很多viewCotnrollers, 我想实现shouldAutorotateToInterfaceOrientation并在Landscape模式下设计一些屏幕。 添加: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } 对我所有的看法控制者,不做工作。 在调试期间,我看到这种方法被调用,但它不会工作!不是在模拟器中,不在设备中,不在Iphone中,不在Ipad中! 我在论坛上搜索过一些答案,并看到一些建议使用: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ); } 没有工作, 添加: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 和 [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 对我的viewDidLoad和viewDidUnload分别没有工作。 我失去了..任何帮助将做! 只有一个信息…所有我的意见是类型UIControl,因为我需要TuchUpInside工作。 适合你的帮助 解决方法
确保您的所有父视图都具有自动调整Subviews = YES。如果您没有在IB中为所有视图设置弹簧和支柱,则可能需要在代码中执行此操作。
引用Interface Builder用户指南:
需要注意的其他几件事情 >如果UINavigationController的根视图控制器也设置为autorotate,那么它只会自动转换。>如果所有的视图控制器都设置为自动转换,UITabBarController将只会自动转换。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |