我一直在以纵向模式编写我的通用应用程序,现在在大约 15 个 nib 文件、许多 viewCotnroller 之后,我想实现 shouldAutorotateToInterfaceOrientation 并在横向模式下设计一些屏幕。
添加:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
到我所有的 viewControllers,不做这项工作。
在调试期间,我看到调用了此方法,但它不起作用!不在模拟器中,不在设备中,不在 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 才能工作。
Appriciate your help.