开发者

UIActionSheet not rotating in landscape mode?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜