Setting the "title" of a UIPopoverController?

Ben Zotto picture Ben Zotto · Apr 11, 2010 · Viewed 12.5k times · Source

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.

Answer

kennytm picture kennytm · Apr 11, 2010

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:….)