Iphone 仅允许左横向和右横向方向
我如何使我的应用程序只允许横向,但同时允许横向(左侧和右侧)? 所以,如果我旋转180°,应用程序将旋转,但如果我在纵向旋转,应用程序不会旋转Iphone 仅允许左横向和右横向方向,iphone,landscape,screen-orientation,Iphone,Landscape,Screen Orientation,我如何使我的应用程序只允许横向,但同时允许横向(左侧和右侧)? 所以,如果我旋转180°,应用程序将旋转,但如果我在纵向旋转,应用程序不会旋转 谢谢尝试将此添加到UIViewController: // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)i
谢谢尝试将此添加到UIViewController:
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
您可以在此处了解更多信息:尝试将其添加到UIViewController:
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
您可以在此处了解更多信息: