1
    pop = [[UIPopoverController alloc] initWithContentViewController:popoverView]; 
    pop.delegate = self;  //optional
    CGSize size = CGSizeMake(300, 100); // size of view in popover…V2
    pop.popoverContentSize = size;

    [pop presentPopoverFromRect:control.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

Youtube link: http://www.youtube.com/watch?v=1iykxemuxbk It works fine in simulator, but crashes when running on iPhone. I can easily get so many articles to implement on iPad, but on iPhone couldn't find a fruitful one. Plz help

Manish Ranjan
  • 43
  • 2
  • 6
  • 2
    Dude you really wanna read apple's HIG first:http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW1 – Raymond Wang Jun 15 '12 at 16:46

6 Answers6

5

UIPopOverController isn't available for iPhone. ONLY iPad.

skram
  • 5,314
  • 1
  • 22
  • 26
  • But I have implemented it and it works just fine in the simulator but crashes while running on iPhone. Why is that? – Manish Ranjan Jun 15 '12 at 15:02
  • 3
    @ManishRanjan If you read the [documentation](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html) that Apple took the time to produce, you will see "Popover controllers are for use exclusively on iPad devices. Attempting to create one on other devices results in an exception." – Nick Bull Jun 15 '12 at 15:03
  • Not only that, but even statically referring to the class will make your app incompatible with iPhone. Use `NSClassFromString(@"UIPopoverController")`, then `NSAllocateObject`. – Seva Alekseyev Jun 15 '12 at 15:03
  • 2
    @ManishRanjan The simulator is NOT an accurate copy of the device. It is there as a development aid, but you must test for real on the actual devices. – Nick Bull Jun 15 '12 at 15:04
  • In case, one needs `UIPopoverController` like implementation for `iPhone`, please see my answer [Here](http://stackoverflow.com/a/14438607/301444). – Vasu Jan 21 '13 at 12:43
1

UIPopOverController will not work for iPhone it will work on Ipad only

mshau
  • 503
  • 4
  • 19
0

If you want to simulate a popover look-alike (e.g. Facebook app), on the iPhone, you will have to code it from scratch using UIViews and custom graphics.

As others said, the popover API is iPad-only.

Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
0

A popover-like open source project that works on iPhone:

here it is

hanumanDev
  • 6,592
  • 11
  • 82
  • 146
0

Try using WEPopover framework. Here is the link https://github.com/werner77/WEPopover

coder1010
  • 412
  • 5
  • 15
0

If you really want to use popover in iphone then try this library. This is pretty cool. I integrated with my ios app.

Custom popover controller for iphone

loganathan
  • 2,056
  • 2
  • 23
  • 34