Note that there are some explanatory texts on larger screens.

plurals
  1. POUIBarButtons too close to the edges of UINavigationBar inside UIPopoverController
    primarykey
    data
    text
    <p>The <code>UIBarButtonItem</code>s in the UINavigationBar inside of our UIPopoverController are hugging the left and right sides of the nav bar:</p> <p><img src="https://i.stack.imgur.com/koYsR.png" alt="Nav Bar"></p> <p>Here is the CustomPopoverController that we implemented. It used to hug the top of the navigation bar as well, but configurePopoverNavBar fixed that.</p> <pre><code>@implementation CMCommentPopoverController - (id)initWithCaseId:(NSString *)cid andViewController:(CMNoteViewController *)cv forView:(UIView *)v { self = [super initWithContentViewController:[[UINavigationController alloc] init]]; self.popoverNav= (UINavigationController *)self.contentViewController; self.caseId = cid; self.dvController = cv; //size the popover CGRect popoverRect = [CMMiscUtil getPopoverRect]; [self setPopoverContentSize:CGSizeMake(popoverRect.size.width, popoverRect.size.height)]; [self presentPopoverFromRect:CGRectMake(popoverRect.origin.x, popoverRect.origin.y, popoverRect.size.width, popoverRect.size.height) inView:v permittedArrowDirections:0 animated:YES]; [self setUpNav]; return self; } - (void) setUpNav { [self.popoverNav pushViewController:self.dvController animated:NO]; self.popoverNav.navigationBar.topItem.title = @"Comments"; //add the buttons to the nav bar of the popover nav controller self.popoverNav.navigationBar.topItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Add Comment" style:UIBarButtonItemStylePlain target:self action:@selector(notesAction:)]; self.popoverNav.navigationBar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(closeAction:)]; [self configurePopoverNavBar:self.popoverNav]; } -(void) configurePopoverNavBar:(UINavigationController *)popoverNav { UINavigationBar *navigationBar = popoverNav.navigationBar; UIView *contentView = nil; for (UIView *view in popoverNav.view.subviews) { if ([[NSString stringWithFormat:@"%@", [view class]] isEqualToString:@"UILayoutContainerView"]) contentView = view; } [navigationBar setFrame:CGRectMake(navigationBar.frame.origin.x, 0, navigationBar.frame.size.width, navigationBar.frame.size.height)]; [contentView setFrame:CGRectMake(contentView.frame.origin.x, 0, contentView.frame.size.width, contentView.frame.size.height+50 + navigationBar.frame.size.height)]; [popoverNav.view bringSubviewToFront:contentView]; for (UIView *customView in contentView.subviews) customView.frame = CGRectMake(customView.frame.origin.x, customView.frame.origin.y + navigationBar.frame.size.height, customView.frame.size.width, customView.frame.size.height); [contentView addSubview:navigationBar]; [contentView bringSubviewToFront:navigationBar]; } ... </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload