How do you set the title of an UIPopOver View programmatically?
I found some sample code but wasn't able to set the title.
myView *theView = [[myView alloc] initWithNibName:@"myView"
bundle:nil];
UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:theView];
[aPopover setDelegate:self];
[aPopover setPopoverContentSize:CGSizeMake(320, 320) animated:YES];
[theView setPopover:aPopover];
[theView release];
[self.popoverController presentPopoverFromRect:CGRectMake(510,370,0,0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
You need to wrap the view controller in a UINavigationCotnroller
which will add a navigation bar with the appropriate title for the view controller. Something like this:
UINavigationController *container =
[[[UINavigationController alloc] initWithRootViewController:viewController] autorelease];
Then just initialize your popover to use container
instead and present it as usual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With