When setting backgroundColor
to [UIColor blackColor]
to a UIPopoverController
everything is fine and presents correctly on iOS7 and iOS8.
I present it via
[aPopover presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
After a device rotation, the popover backgroundColor
is reset to default color (white in this case).
This does not happend in iOS 7. Only on iOS 8
I have already tried with
- (void)presentPopoverFromRect:(CGRect)rect
inView:(UIView *)view
permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections
animated:(BOOL)animated;
and a repositioning using UIPopoverControllerDelegate
and the same problem occurs.
Last information : I had this problem only when displaying the popover on a UINavigationBar but not when presenting it on a regular UIView
or any UIButton
.
Thanks for your help
I also had such problem with popover on iOS8. Besides rotation the background colour was reset when popover changed its size (e.g. when keyboard shows up to edit some text field in the popover).
The key observation is that the issue usually happens with popovers that have its arrow on the very content's edge (and this is the case when presenting popover from UIBarButtonItem
of full screen view controller).
Hence my workaround was to modify sourceRect
just enough for the popover's arrow to move away from its corner. For example in my particular case I had a bar button item with custom 33x33 view (which was used as sourceView
) and the issue was fixed by setting sourceRect
to {20, 30, 0, 0}
instead of custom view's bounds (though I suppose the exact required offset may depend on popover's size).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With