Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 仅允许左横向和右横向方向_Iphone_Landscape_Screen Orientation - Fatal编程技术网

Iphone 仅允许左横向和右横向方向

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

我如何使我的应用程序只允许横向,但同时允许横向(左侧和右侧)? 所以,如果我旋转180°,应用程序将旋转,但如果我在纵向旋转,应用程序不会旋转


谢谢

尝试将此添加到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);
}
您可以在此处了解更多信息: