开发者

Xcode: how to build a landscape only iphone program

开发者 https://www.devze.com 2023-02-28 18:25 出处:网络
in Xcode, I tried to design a landscape only user interface. I both set UIViewController and UIView controls to landscape model. but when I placed the controls, like buttons, imag开发者_运维知识库es

in Xcode, I tried to design a landscape only user interface.

I both set UIViewController and UIView controls to landscape model. but when I placed the controls, like buttons, imag开发者_运维知识库es on the UIView, when programe running, only the controls which are placed on top-left area response. Seems the programe is still running in portrait mode.


In project plist setup Initial interface orientation field in Landscape (left home button). Also setup Supported interface orientations field.

And override method -(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation in your ViewController:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
0

精彩评论

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

关注公众号