Search code examples
iosobjective-csizeuipopovercontroller

Create PopOver Without Arrows and Centered in UIViewController


I am attempting to display a PopOver in the Center of the ipad in Landscape Orientation. I am able to do it now with the code below but it does not have the Properties that are associated with the "popOverViewController" that is linked up on storyboard. I want it to be a view on storyboard so that I am able to work on and edit it. As well as be able to change the size of it to be either 50% or 75% of the ipads full view and no arrow...

Please, anything will help. *Updated code....can now set size. But still not seeing the "popOverViewController" content.

self.popOverViewController = [[PopOverViewController alloc]init];
self.popOver = [[UIPopoverController alloc]
                            initWithContentViewController:self.popOverViewController];
CGSize size = CGSizeMake(400.0,300.0);
[self.popOver setPopoverContentSize:size];
CGRect rect = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2, 1, 1);
[self.popOver presentPopoverFromRect:rect inView:self.view permittedArrowDirections:0 animated:YES];

Solution

  • Alright. So I did this...

    popOverViewController =  [self.storyboard instantiateViewControllerWithIdentifier:@"popOver"];