1

I have the following code for a UIPopoverController. It is working fine in iOS 7. However, in iOS 8, the popover becomes full-screen which I do not want. How do I keep the popover from filling the entire screen in iOS8?

CGRect buttonFrame = [[[[[self tabBarController] tabBar] subviews] objectAtIndex:index+1] frame];

popover = [[UIPopoverController alloc]initWithContentViewController:viewmapmenu] ;

popover.popoverContentSize = CGSizeMake(95, 128.0) ;

popover.delegate = self ;

[popover presentPopoverFromRect:buttonFrame inView:self.tabBarController.tabBar permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES] ;
tjpaul
  • 343
  • 3
  • 16
jach
  • 11
  • 2

2 Answers2

2

Try to add this delegate method.

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller;{
    return UIModalPresentationNone;
}
gabbler
  • 13,626
  • 4
  • 32
  • 44
1

See, here is the situation. if you are presenting the popover in iPhone then it will not work in iOS 8 as Apple has completely restricted it even if it was previously working. Now you cannot present popover in iPhone as all the access to the private methods of UIPopover is blocked.

You can look into the FPopover Library in github to use popover in iPhone:- https://github.com/50pixels/FPPopover

Shikhar varshney
  • 816
  • 1
  • 9
  • 23