A few suggestions here ...
First, do you use automatic link counting (ARC)? if so, you need to have an instance variable to control your UIPopoverController . For instance:
@property (strong, nonatomic) UIPopoverController* popover;
if you are not using ARC, create a retain one:
@property (retain, nonatomic) UIPopoverController* popover;
In the first case, you should do this, because if not, ARC will release a popover just created for you at the end of your IBAction. In addition, you do this to have a link for your popover. See note. This is also true if you are not using ARC.
NOTE. At some point, you may need to release a popover. For example, in - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController do
self.popover = nil;
Then, if your SecondView is a UIViewController call to SecondViewController . But this is a simple sentence for naming.
Finally, the correct way to display a popover from the action sender (for example, a UIButton ) instead of hard code positions could be:
- (IBAction)openPopover:(id)sender {
source share