I present popover with UITextField in it. Everything works fine (arrow points to sourceRect). Then I tap textfield and keyboard opens. Popover gets moved and arrow direction is changed. That's fine too. But when I dismiss keyboard, arrow remains at same direction.
Here is my simple project https://github.com/sirljan/PopoverArrow
I present it this way:
- (IBAction)buttonTapped:(UIButton *)sender {
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController * vc = [sb instantiateViewControllerWithIdentifier:@"MyPopover"];
vc.modalPresentationStyle = UIModalPresentationPopover;
vc.popoverPresentationController.sourceView = self.view; \\self.view is sender.superview
vc.popoverPresentationController.sourceRect = sender.frame;
vc.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionDown | UIPopoverArrowDirectionUp;
[self presentViewController:vc animated:YES completion:nil];
}
I would like to have arrow only up or down. popoverPresentationController.arrowDirection
is readOnly so I can't change it when
- popoverPresentationController:willRepositionPopoverToRect:inView:
is called. Do you have any suggestion how to set arrow correctly?