Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPopoverController not sizing correctly in iOS 8

Prior to iOS 8 my app using UIPopoverController was working fine. I had it anchored and opening up at a size of 400 x 215. However now when i run my app on iPad using iOS 8 my popover window is not sized properly. Its almost popping up at the full height and width off my anchor. Since iOS is so new i can't seem to find an adjustment for this. Below is my code:

UIView *anchor = self.personAnchor;
        UIViewController *viewControllerForPopover =
        [self.storyboard instantiateViewControllerWithIdentifier:@"choosePersonViewController"];


        popover = [[UIPopoverController alloc]
                   initWithContentViewController:viewControllerForPopover];
        popover.popoverContentSize = CGSizeMake(400, 215);
        popover.delegate = self;
        [popover presentPopoverFromRect:anchor.frame
                                 inView:anchor.superview
               permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
like image 482
user520300 Avatar asked Oct 06 '14 14:10

user520300


1 Answers

Set the view controller's preferredContentSize instead of setting the popover's popoverContentSize - copied from comment

like image 102
gndp Avatar answered Nov 18 '22 14:11

gndp