UIActionSheet 在横向模式下不旋转?
我有一个 UIActionSheet,我将其视图设置如下:
[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 portrait. What am I doing wrong?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您将其显示在窗口中(未旋转),而不是在视图控制器的视图中(已旋转)。而是传递当前可见视图控制器的主视图,或者在 iPhone 上使用
showFromTabBar:
或showFromToolbar:
或showFromBarButtonItem:animated:
或 < iPad 上的代码>showFromRect:inView:animated:。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:
orshowFromToolbar:
on iPhone orshowFromBarButtonItem:animated:
orshowFromRect:inView:animated:
on iPad.你可以用这个代替:
You can use this instead:
[弹出showFromToolbar:self.view];
特别适用于 ActionSheet 中的 ActionSheet。
[popup showFromToolbar:self.view];
Special for ActionSheet within ActionSheet.