顶部的 UIPopoverController 工具栏
我试图将 UIToolbar 放置在 UIPopoverController 的顶部,就像 Apple 在页面和主题演讲中使用“媒体”、“表格”、“图表”“形状”工具栏所做的那样。
我已设法使用与 这篇文章但我无法将其移至顶部。
我可以通过在子视图控制器之一中放置一个普通的 UIToolbar 来做到这一点,但是工具栏似乎并不遵循与边框相同的线,并且看起来不像在苹果应用程序中那么漂亮。
有没有人对如何做到这一点有任何建议,或者是否可能?任何帮助将不胜感激。
谢谢!
I am trying to place a UIToolbar at the top of a UIPopoverController in much the same way as Apple have done in pages and keynote with the "media", "tables", "charts" "shapes" toolbar.
I've managed to place one at the bottom using the same method described as in this post but I'm unable to move it to the top.
I can do it by just placing a normal UIToolbar within one of the child view controllers however the toolbar does not seem to follow the same line as the border and doesn't look as nice as it does in the apple apps.
Does anyone have any suggestions on how to do this, or if it's even possible? Any help would be much appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用只包含一个 ViewController 作为 popoverController 内容的 UINavigationController,如下所示:
然后,在 viewController 的 init 中,设置 navigationController 的项目:
你可以疯狂地把你想要的任何东西放在那里:
如果满足以下条件,你的导航控制器将不会进行导航:它的堆栈上只有一个 ViewController。
iOS 7 警告:弹出窗口内的导航栏似乎忽略了 iOS 7 中的色调。我认为这是一个错误,如果您遇到此问题,鼓励您向 Apple 提交错误报告。
Use a UINavigationController that holds just your one ViewController as the popoverController's content, like so:
Then, in your viewController's init, set the navigationController's items:
You can go crazy and put whatever you want in there:
Your navigation controller won't be navigating if there is only one ViewController on its stack.
iOS 7 caveat: NavigationBars inside popovers seem to ignore tint in iOS 7. I think that's a bug and encourage you to file a bug report with apple if you encounter this issue.
您可以将工具栏放在 UIPopoverController 之上。
更准确地说,您必须将其放在 UIViewController 之上,在调用 initWithContentViewController 时将其设置为 UIPopoverController 的内容。
如果您使用IB:
1) 将 UItoolbar 拖到 UIViewController 的顶部
2) 选择 UIToolbar,转到尺寸检查器并在自动调整大小部分:
- 单击顶部指示器来修复上边距
- 单击底部指示器以使底部边距灵活
在小预览窗口中,红色条应保留在顶部
You can put a toolbar on top of your UIPopoverController.
More precisely you have to put it on top of the UIViewController that will be set as the content of your UIPopoverController when calling initWithContentViewController.
If you are using IB:
1) drag a UItoolbar to the top of your UIViewController
2) select the UIToolbar, go to the size inspector and in the autosizing section:
- click on the top indicator to fix the top margin
- click on the bottom indicator to make the bottom margin flexible
In the little preview window the red bar should stay on top