Saturday, June 30, 2012

iPhone popover overlay view over navigation controller bar issues & fixes

I was trying to add a popover view to my iPhone app, To get this done there is a nice and popular solution
https://github.com/werner77/WEPopover/
(i.e.  popover implementation for iPhone with same API as the UIPopoverController for the iPad)
While adding it on navigation controller bar, I found 2 issues:

Issue #1:  It was not appearing on app launch but on app resume.
Solution : In WEPopOverController controller class

- (void)presentPopoverFromRect:(CGRect)rect  inView:(UIView *)theView   permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated {}

change  from [keyView addSubview:backgroundView];
to [theView addSubview:backgroundView];

Issue #2. It was hidden behind nav bar.
Solution : With Instance of WEPopoverController, presentPopoverFromRect:inView:permittedArrowDirections:animated:, Instead of presenting it in self.view I have presented it further up in the view hierarchy (I did in self.view.window)

No comments:

Post a Comment