UIPopoverController 放置
我正在开发一款应该是通用的应用程序,一款同时适用于 iPad 和 iPhone 的应用程序。我想让他们的界面尽可能相似。在 iPhone 应用程序中,我使用选项卡栏控制器,其中一个选项卡转到图像选择器控制器。显然我无法在 iPad 上做到这一点。因此,我劫持了该按钮的控制权,以引入一个包含图像选择器的弹出控制器。这一切都运行得很好,除了当我打开弹出窗口时,它不在正确的位置。当我旋转模拟器时,弹出窗口会转到正确的位置,并且当我向后旋转时,弹出窗口会保持不变。
我的代码基于这个问题中的代码: Ipad UIImagePickerController 和 UIPopoverController 错误
为什么我的弹出窗口不在正确的位置?
I'm working on an app that is supposed to be universal, one app for both iPad and iPhone. I would like to keep their interfaces as similar as possible. In the iPhone app I am using a Tab bar controller, and one of those tabs goes to an image picker controller. Obviously I cannot do that in iPad. So I have hijacked control of that button to bring a popupcontroller that has the image picker in it. This all works well enough, except when I bring up the popup, it is not in the correct place. When I rotate the simulator, the popup goes to the correct place, and stays when I rotate back even.
My code is based on the code in this question:
Ipad UIImagePickerController and UIPopoverController error
Why would my popup not be in the correct location?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的代码基于您引用的问题,则您似乎正在使用以下代码来显示弹出窗口:
UIPopoverController:presentPopoverFromBarButtonItem:permissedArrowDirections:animated 接受 UITabBar 没有的发件人的 UIBarButtonItem* 。 UITabBar 使用具有 UIBarItem 基础的 UITabBarItem。 UIBarButtonItem 也有该基础 (UIBarItem)。
无论如何...我还需要从 tabbaritem 显示 uipopovercontroller,我使用了以下代码:
注意:您的 x 计算将会有所不同。为我选择的选项卡栏项目是第六个。
基本上
If your code is based on the question you referenced, it would appear you are using the following code to show the popover:
UIPopoverController:presentPopoverFromBarButtonItem:permittedArrowDirections:animated accepts a UIBarButtonItem* for the sender which your UITabBar does not have. UITabBar uses UITabBarItem which has a base of UIBarItem. UIBarButtonItem also has that base (UIBarItem).
Anyhow... I also needed to show a uipopovercontroller from a tabbaritem, I used the following code:
Note: your x calculation will be different. The tab bar item selected for me was the 6th one.
Basically