【发布时间】:2011-06-15 04:38:36
【问题描述】:
如何以横向模式启动我的应用,并保持屏幕旋转?
【问题讨论】:
标签: objective-c ios cocoa-touch landscape uiinterfaceorientation
如何以横向模式启动我的应用,并保持屏幕旋转?
【问题讨论】:
标签: objective-c ios cocoa-touch landscape uiinterfaceorientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
【讨论】:
实现视图控制器的shouldAutorotateToInterfaceOrientation:方法和return UIInterfaceOrientationIsLandscape(orientation);
还将Info.plist 键UIInterfaceOrientation 和UISupportedInterfaceOrientations 设置为UIInterfaceOrientationLandscapeLeft 和UIInterfaceOrientationLandscapeRight。 UIInterfaceOrientation 将采用单个值,因此分配其中一个并将它们都分配给 UISupportedInterfaceOrientations。
【讨论】: