0

I am attempting to present a UIPopoverController similar to the bookmark selector in Safari with the title above and the ability to go back and forward. I found this tutorial: http://mobiforge.com/designing/story/using-popoverview-ipad-app-development and have followed it, yet my navigation bar is not appearing like it should be. Instead, it is appearing like it is recessed in the popover controller and not actually part of the popover controller. Below is the code I have so far. Any help would be greatly appreciated.

Code:

- (IBAction)addAPrePlan:(id)sender
{
    if (![self.preplanPopoverController isPopoverVisible]) {

        // Initiate the popover controller
        UITableViewController *pp = [[UITableViewController alloc] init];
        pp.navigationItem.title = @"Add a PrePlan";
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:pp];
        UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:nav];
        popover.delegate = self;
        self.preplanPopoverController = popover;
    }
    else {

        // Dissmiss the popover
        [self.preplanPopoverController dismissPopoverAnimated:YES];
    }

    // Present the popover controller
    [self.preplanPopoverController presentPopoverFromBarButtonItem:self.addAPrePlanButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
Carl Veazey
  • 18,392
  • 8
  • 66
  • 81
Jon Erickson
  • 1,876
  • 4
  • 30
  • 73
  • 1
    What you are doing is correct. Under iOS 6 and earlier, the border around the popover covers the top part of the navbar. This is normal. – rmaddy Aug 26 '13 at 05:18
  • 1
    Can u share a screen shot of what you are actually getting? – Satheesh Aug 26 '13 at 05:25
  • I am using iOS 6.1 so it should not effect it! – Jon Erickson Aug 26 '13 at 05:34
  • Image: http://s14.postimg.org/cyiuefukh/IMG_0002.png – Jon Erickson Aug 26 '13 at 05:40
  • As rmaddy said, what you're seeing is normal for iOS 6 and previous versions (that means 6.1 too). – rdelmar Aug 26 '13 at 05:41
  • Then how do they do the bookmark selector in Safari? Using a popoverBackgroundViewClass? – Jon Erickson Aug 26 '13 at 05:42
  • @JonErickson What is different about the bookmarks popover in Mobile Safari from the image you posted. The appear the same to me. – rmaddy Aug 26 '13 at 05:46
  • Ok, after looking at your image more closely, I do see a difference, but when I copied and pasted your code, it looks exactly like the Safari bookmarks selector, not like your image (using Xcode 4.6.3). – rdelmar Aug 26 '13 at 05:53
  • @rmaddy The NavBar is attached to the tableview in mine where as in the popover in Safari, the navbar is a part of the popover view itself. – Jon Erickson Aug 26 '13 at 05:53
  • @rdelmar Hmm that is strange. I am using 4.6.3 as well. Something is interfering with it. Are you presenting from a barButtonItem or rect? – Jon Erickson Aug 26 '13 at 05:55
  • Copied your code exactly. I added a tool bar with one button in IB to the main view controller and assigned the addAPrePlanButton outlet to it. – rdelmar Aug 26 '13 at 05:56
  • your controller is UIViewCOntroller or UITableViewController? – Sunny Shah Aug 26 '13 at 05:57
  • UITableViewController as it says in the code above... – Jon Erickson Aug 26 '13 at 05:58
  • So I just created it as well in a separate application and it worked fine. I have no idea what would interfere with it in my original application. – Jon Erickson Aug 26 '13 at 06:03

0 Answers0