开发者

UIActionSheet not rotating in landscape mode?

开发者 https://www.devze.com 2023-03-05 10:58 出处:网络
I have a UIActionSheet and I set it\'s view like this: [popup showInView:[[UIApplication sharedApplication] keyWindow]];

I have a UIActionSheet and I set it's view like this:

[popup showInView:[[UIApplication sharedApplication] keyWindow]];

this works fine in portrait mode, but when I switch to landscape, it stays 开发者_如何学JAVAportrait. What am I doing wrong? Thanks.


You're showing it in the window (which is not rotated), rather than in a view controller's view (which is). Pass the main view of your currently-visible view controller instead, or use showFromTabBar: or showFromToolbar: on iPhone or showFromBarButtonItem:animated: or showFromRect:inView:animated: on iPad.


You can use this instead:

[popup showInView:[UIApplication sharedApplication].keyWindow.rootViewController.view];


[popup showFromToolbar:self.view];

Special for ActionSheet within ActionSheet.

0

精彩评论

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

关注公众号