开发者

How to forcefully make Device in landscape mode

开发者 https://www.devze.com 2023-02-28 11:53 出处:网络
I have and app in that app is running in potr开发者_如何学Pythonait mode and when i go to the next wiew i have to change the device orientation in landscape mode. Is there any way.Put the below code i

I have and app in that app is running in potr开发者_如何学Pythonait mode and when i go to the next wiew i have to change the device orientation in landscape mode. Is there any way.


Put the below code in your controller class for having different orientation between UIViewControllers,

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  // Return YES for supported orientations
  return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

You could also try with below having different orientation between views.

[[UIDevice currentDevice] performSelector:@selector(setOrientation:) withObject:(id)UIInterfaceOrientationLandscapeRight];


No. [UIDevice setOrientation:] does that, but it's a private API.

0

精彩评论

暂无评论...
验证码 换一张
取 消