iOS- How to add objects in a popoverController in iPhone?

310 views Asked by At

In my app, I have a button, when it is clicked a popoverView will be displayed.
I used the following code
First, I added UIPopover+Iphone.h and UIPopover+Iphone.m files from the link Popover view for iPhone using XCode 5

-(IBAction)buttonClicked:(id)sender
{
   UIViewController *popoverViewController=[[UIViewController alloc]init];
   UIPopoverController * popoverController=[[UIPopoverController alloc]initWithContentViewController:popoverViewController];
popoverController.popoverContentSize=CGSizeMake(200, 200);
   [popoverController presentPopoverFromRect:timingTextField.frame inView:self.view permittedArrowDirections: UIPopoverArrowDirectionUp animated:YES];
}  

I got an output like this
enter image description here

Now I want to insert some objects in it, say a button or some other equivalent UI element. Can anyone please suggest me something. Thanks in advance.

1

There are 1 answers

8
thorb65 On BEST ANSWER

Add the elements you want to your UIViewController *popoverViewController. this is the viewcontroller that is displayed in PopoverController * popoverController.