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).
我确信这里有一些显而易见的东西,但我知道popover控件可以有“标题”,标题区域在内容视图上方有一行文本(例如iWork中的“工具”弹出窗口)。
How can I add this in my own popovers?
如何在我自己的popovers中添加它?
Thanks.
谢谢。
2 个解决方案
#1
38
If you're using a UIPopoverController, just make its contentViewController
to be a UINavigationController
, and set the title
of its deepest view controller.
如果您正在使用UIPopoverController,只需将其contentViewController设置为UINavigationController,并设置其最深视图控制器的标题。
If you're using a UIActionSheet, it has a title
property already (which you should notice when initializing with -initWithTitle:…
.)
如果您正在使用UIActionSheet,它已经具有title属性(在使用-initWithTitle进行初始化时应注意:...。)
#2
8
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.
我整天都在用同样的问题撞墙,我想我终于有了解决方案:D你需要为popover的contentViewController使用UINavigationController,然后在导航控制器的导航栏上添加一个标题,就像你一样通常会。奇怪的是,如果您向现有视图控制器添加导航栏,则不起作用。
#1
38
If you're using a UIPopoverController, just make its contentViewController
to be a UINavigationController
, and set the title
of its deepest view controller.
如果您正在使用UIPopoverController,只需将其contentViewController设置为UINavigationController,并设置其最深视图控制器的标题。
If you're using a UIActionSheet, it has a title
property already (which you should notice when initializing with -initWithTitle:…
.)
如果您正在使用UIActionSheet,它已经具有title属性(在使用-initWithTitle进行初始化时应注意:...。)
#2
8
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.
我整天都在用同样的问题撞墙,我想我终于有了解决方案:D你需要为popover的contentViewController使用UINavigationController,然后在导航控制器的导航栏上添加一个标题,就像你一样通常会。奇怪的是,如果您向现有视图控制器添加导航栏,则不起作用。