我一直在以纵向模式编写我的Universal应用程序,现在在大约15个nib文件,许多viewCotnrollers之后,我想实现shouldAutorotateToInterfaceOrientation并在Landscape模式下设计一些屏幕.
添加:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
Run Code Online (Sandbox Code Playgroud)
对我的所有viewControllers,都不做这项工作.
在调试期间,我看到这个方法被调用,但它不起作用!不在模拟器中,不在设备中,不在Iphone中,不在Ipad中!
我在论坛中搜索了一些答案,并看到了一些建议:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown );
}
Run Code Online (Sandbox Code Playgroud)
也没用,
添加:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
Run Code Online (Sandbox Code Playgroud)
和
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
Run Code Online (Sandbox Code Playgroud)
到我的viewDidLoad和viewDidUnload也分别没用.
我迷路了...任何帮助都会做!
还有一个信息...我的所有视图都是UIControl类型,因为我需要TuchUpInside才能工作.
赞赏你的帮助.