0
votes

I'm creating a popover like this.

-(void)showPop{

    if (self.popoverController2 == nil) {


        RootViewController *iap = 
        [[RootViewController alloc]initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
        [iap setDelegate:self];


        UIPopoverController *popover = 
        [[UIPopoverController alloc] initWithContentViewController:iap]; 

        popover.delegate = self;

        popover.popoverContentSize = CGSizeMake(320, 300);  

        self.popoverController2 = popover;


    }


    CGRect popoverRect = [self.view convertRect:[shopButton frame] fromView:[shopButton superview]];


    [self.popoverController2 presentPopoverFromRect:shopButton.bounds inView:shopButton 
                           permittedArrowDirections:UIPopoverArrowDirectionAny 
                                           animated:YES];


}

ShopButton is a button from which the popover pops up. Now the problem is, when I rotate my device, The popover remains on the position it was drawn while the rest of the view adjusts according to the rotation. In simple words, when device is rotated with the popover drawn (popping up from UIButton), the popover doesn't move along with the UIButton. If I close the popover and again draw it from the button, It draws correctly above the button. The problem only comes when rotating with the popover popped up.

Please help ASAP. Thank you :)

1

1 Answers

0
votes

You can hide popover before orientation will change and show it again with new coords right after.