UIPopoverController Toolbar at the top

I try to place the UIToolbar at the top of the UIPopoverController in much the same way as Apple, by doing this on the pages and speaking with the toolbar "media", "tables", "charts" "shape".

enter image description here

I managed to place it at the bottom using the same method that is described in this post , but I can not move it to the beginning.

I can do this by simply placing the regular UIToolbar in one of the child controllers, however the toolbar does not seem to match the same line as the border and does not look as good as in apple apps.

Does anyone have any suggestions on how to do this, or if possible? Any help would be greatly appreciated.

Thank!

+5
source share
2 answers

Use a UINavigationController that only contains your ViewController as the contents of the popoverController, for example:

MyViewController *myVC = [[myViewController alloc] init];

UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:myVC];

myPopoverController = [[UIPopoverController alloc] initWithContentViewController:navCon];

[myVC release];
[navCon release];

[myPopoverController presentPopoverFromRect:rect
                                     inView:view
                   permittedArrowDirections:UIPopoverArrowDirectionRight
                                   animated:YES];

Then, in your viewController control, set the navigationController elements:

self.navigationItem.title = @"myTitle";
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editButtonTapped:)] autorelease];

You can go crazy and put where you want:

self.navigationItem.titleView = [[MySpecialTitleView alloc] initWithFrame...];

The navigation controller will not move if there is only one ViewController in its stack.

iOS 7 caveat: NavigationBars inside popovers seems to ignore the hue in iOS 7. I think the error and recommend that you write an error report with apple if you encounter this problem.

+10
source

You can put a toolbar on top of your UIPopoverController.

, UIViewController, UIPopoverController initWithContentViewController.

IB:
1) UItoolbar UIViewController

2) UIToolbar, :
 - ,
 - ,

+1

All Articles