2
votes

Presented Popover on Video Button Tap:

[self.popOverController presentPopoverFromRect:[self.view convertRect:buttonFrame toView:self.view.window]
                                                inView:self.view.window
                              permittedArrowDirections:UIPopoverArrowDirectionUp
                                              animated:YES];

videoButton 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.

On orientation, I want to change the frame position rather than dismissing it and presenting it again. How can I do it this way?

1
The only way to achieve that without dismissing it and presenting it again is to set the autoresizing mask for your button. It 'll definitely work out.Mani Kandan

1 Answers

0
votes

You can call present popover method again on will change orientation method.

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];

    [self.popOverController presentPopoverFromRect:[self.view convertRect:buttonFrame toView:self.view.window] inView:self.view.window permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}