views:

1130

answers:

3

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.

+6  A: 

If you're using a UIPopoverController, just make its contentViewController to be a UINagivationController, 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:….)

KennyTM
+2  A: 

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.

Scott H.
A: 

I tried just adding a UINavigationBar directly to my subview (rather than using a UINavigationController.

It works fine, but the nav bar appears differently from how the built-in ones in Calendar and so on behave. It is not translucent no mater what settings I use in IB, and there is a visible "seam" around the edge of the nav bar that is not present in the built-in examples.

Are popovers do some special extra magic when the content view controller is a UINavigationController? If so, I wish Apple would document this.

Matthew Self