there is only one problem, the wrong place to call the presentPopover method, splitViewController: * WillHide * ViewController ....... therefore, barButtonItem exists, but is not present on the screen. I used the following code and it worked for me. To handle all cases you need to use 2 methods.
- (void)viewDidAppear:(BOOL)animated { if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) { if (self.view.window != nil) { [_masterPopoverController presentPopoverFromRect:CGRectMake(0, 0, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:NO]; } } [super viewDidAppear:animated]; }
and
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { if (fromInterfaceOrientation == UIDeviceOrientationLandscapeLeft || fromInterfaceOrientation == UIDeviceOrientationLandscapeRight) { if (self.view.window != nil) { [_masterPopoverController presentPopoverFromRect:CGRectMake(0, 0, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:NO]; } } }
source share