I'd like to design my views quietly in Interface Builder, then to be able to display them dynamically as an UIPopoverController.
I found this precious tutorial by Ray Wenderlich but I cannot extend it to my needs.
Anyone could help me?
Here is how I usually do it: let's say I have a parent view controller in which I want to present the popover. I declare a popover controller as a property for that VC ( @property (nonatomic, retain) UIPopoverController* popOverController; )
The code for presenting a popover with a new view controller, let's call it ViewController2, would be this one
ViewController2* viewController2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
self.popOverController = [[UIPopoverController alloc] initWithContentViewController:viewController2];
popOverController.popoverContentSize = CGSizeMake(350, 216); //or whatever size you need
//this will present the view controller from the sender's frame, assuming this code is used inside an IBAction
//and the popover's arrow will point down
[popOverController presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
[viewController2 release];
[popOverController release];
That's pretty much it... If you run into any problems, I'll try to give you more infos.
P.S. I am not claiming this is the best way to do it, I have less than an year of experience with iOs, but that's how we usually do it where I work