Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad UIPopoverController How to Set the Title

I have a UIPopoverController which displays a table. I use the PresentFromBarButtonItem method.

How can I give the pop up a title to display, much list the UISpliter does?

like image 883
Ian Vink Avatar asked Nov 28 '22 18:11

Ian Vink


2 Answers

1. Set title parameter of your UITableViewController;

2. Add your UITableViewController to an UINavigationController.

@interface YourTableViewController : UITableViewController < ... >
...
@end

...

...

YourTableViewController *vc = [[YourTableViewController alloc] init...  ;
vc.title = @"Some Title";

// add vc to an UINavigationController then forget it.
UINavigationController *nav = [[UINavigationController alloc]
                                initWithRootViewController:vc];
[vc release];

UIPopoverController *some_pvc = [[UIPopoverController alloc]
                                  initWithContentViewController:nav];
[nav release];

Then show the UIPopoverController some_pvc by sending presentPopoverFromRect: ... message to an UIViewController you will see the title bar

alt text

like image 58
Eric Chai Avatar answered Dec 01 '22 00:12

Eric Chai


I don't know what you mean by UISpliter, but you need to "wrap" your view controller in a UINavigationController and show the navigation controller in a popover. Your view controller's title property will appear above the view controller's view.

like image 41
Costique Avatar answered Dec 01 '22 00:12

Costique