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.
精彩评论