开发者

root UIViewController orientation landscape, touches weird in subviews

开发者 https://www.devze.com 2023-02-04 03:03 出处:网络
I\'m making an application which will be landscape only. Therefore, my root UIViewController is set to be landscape (开发者_Go百科all xib files I have are landscape orientation).

I'm making an application which will be landscape only. Therefore, my root UIViewController is set to be landscape (开发者_Go百科all xib files I have are landscape orientation).

// Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

When I try to touch a button in one of the subviews, it does not receive a touch. If I remove the override shown above, the buttons get the touches, but the subview is shown in portrait orientation.

How should I work around this problem?

Thanks & Best Regards,

David


Aside from that, you have to set the supported orientations in your info.plist file.

Its under "Supported interface orientations", with key "UISupportedInterfaceOrientations". Remove the portrait orientations in the list.

0

精彩评论

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