Setting the “title” of a UIPopoverController?

為{幸葍}努か 提交于 2019-11-29 05:49:38

问题


I'm sure there's something obvious I'm missing here, but I know that popover controls can have "titles", a header area that has a line of text above the content view (e.g. the "Tools" popover in iWork).

How can I add this in my own popovers?

Thanks.


回答1:


If you're using a UIPopoverController, just make its contentViewController to be a UINavigationController, and set the title of its deepest view controller.

If you're using a UIActionSheet, it has a title property already (which you should notice when initializing with -initWithTitle:….)




回答2:


I have been beating my head against the wall all day with the same problem and I think I finally have the solution :D You need to use a UINavigationController for the popover's contentViewController, and then add a title to the navigations controller's navigation bar, like you normally would. Oddly, this doesn't work if you add a navigation bar to your existing view controller.



来源:https://stackoverflow.com/questions/2617409/setting-the-title-of-a-uipopovercontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!