Before I implement something similar for the iPhone, I'm wondering if anyone has implemented something similar of the UIPopOverController for the iPhone. This is so far only available for iPad.
6 Answers
See my implementation here: https://github.com/werner77/WEPopover
It has the same interface as the UIPopoverController but is generalized for iPhone and with support for custom background views.

- 10,080
- 4
- 53
- 60
-
Very Useful. Great Work Done! – Jyotsna Mar 07 '12 at 13:56
-
There're bugs. 1. Crash if delegate does not implement shouldDismissPopover (easily fixable). Since you've declared the method as optional, not implementing the method is correct behaviour. 2. Does not resizes itself when popoverContentSize changes while the popover is visible. This one is not easily fixable (at least not for the 10 minutes I tried to, but I'll do it anyway because to there're fatal design flaws in UIKit's version). P.S. I'll happily share my fixes, I need your e-mail address for that - don't know how to submit a pull request with GitX client I'm using. – Soonts May 15 '12 at 21:03
-
2Will apple approves pop over controller in iPhone? – Bharathi Dec 13 '12 at 05:38
-
Will the app be rejected when we submit it on app store? – i_raqz Jan 05 '13 at 14:42
-
@Jasmine: The Facebook app has a popover controller and it's in the app store so perhaps Apple would approve. – acecapades Feb 18 '13 at 05:57
I have provided another alternative SGPopoverController at http://github.com/KJoyner/SeaGlass. Like the WEPopover, this has a similar interface to UIPovoerController but works on the iPhone. This version handles more corner cases, works both modally and non-modally, supports passthrough views, and more.

- 921
- 9
- 14
-
-
I didn't find SGPopoverController all that great. It has rendering issues when the arrows are near the corners, for one. Secondly it is missing a presentPopoverFromBarButtonItem method. If you need a drop-in replacement for UIPopoverController, this one isn't it - yet. – TomSwift Jul 13 '11 at 19:12
-
What kind of rendering issues are you having? Can you enter an issue on github and I will take a look at it. – Ken Joyner Jul 27 '11 at 23:23
-
Also, Apple does not provide a documented API to make the presentPopoverFromBarButtinItem work 100% of the time (especially during device rotation). This is documented in the docx file, but here is the code I use to anchor it in the bar button action: if ([event respondsToSelector:@selector(allTouches)]) { UIView* itemView = [[event.allTouches anyObject] view]; anchor = [itemView convertRect:itemView.bounds toView:primaryView]; } else { // we ignore the event and just return if we cannot determine an anchor return; } – Ken Joyner Jul 27 '11 at 23:35
-
@KenJoyner Can u please help me to get the "SeaGlass library" as its not there in the sample project u provided. – iLearner Nov 30 '12 at 09:41
Create UIPopover+iPhone.h
#import <Foundation/Foundation.h>
@interface UIPopoverController (overrides)
+ (BOOL)_popoversDisabled;
@end

- 90,663
- 31
- 146
- 203

- 215
- 4
- 11
-
3Just a note that this wouldn't be approved in the App Store review since it's a private var. – runmad Oct 01 '12 at 20:30
-
Might work if you don't use the category approach, but subclass the UIPopoverController. – stigi Sep 19 '13 at 11:26
There's a reason UIPopoverController isn't a standard UI element on the iPhone, is that screen space is rather restricted. Having a popover, that's easily readable, implies that a fair amount of the iPhone screen will be taken up by the popover. Perhaps you should rethink your UI decision.
Maybe a coverVertical modal view?

- 2,501
- 2
- 23
- 30
-
2This is not true. There's an undocumented UICalloutView within MapKit that serves similar purpose. It doesn't need to be as large as the PopoverController, but just enough to display some well defined content view that I pass to it. – Brian Liang Oct 16 '10 at 19:25
-
I guess I will re write the UICalloutView outside of MapKit. Thanks for the suggestion though. – Brian Liang Oct 16 '10 at 19:27
Found another git. Looks more updated and actively maintained. it uses QuantzCore to draw the popover, which looks as elegant as iOS's SDK native. Just for your reference: https://github.com/50pixels/FPPopover

- 3,517
- 3
- 32
- 33
Basically the best way to do this is to implement custom UIAlertView subclasses that look/behave how you want, via custom animations and being able to click behind and disappear (if you want that functionality, as UIPopoverController has it)
Edit: you can also try using a view and presenting it modally, though the animations might not be what you are looking for.

- 9,780
- 1
- 41
- 56