Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPopoverController and UINavigationController cuts corners
    text
    copied!<p>I have a problem with the display of my popover. After <code>initWithContentViewController:</code> and <code>presentPopoverFromBarButtonItem:permittedArrowDirections:animated:</code> it cuts corners of the navigation bar. How should I fix it?? Thanks.</p> <p><img src="https://i.stack.imgur.com/QLBNI.png" alt="Clipping corners of navigation bar"></p> <p>This is the code I'm using</p> <pre><code> NavContr *nav = [NavContr new]; nav.navigationBar.backgroundColor = [UIColor redColor]; UIPopoverController *tempPop = [[UIPopoverController alloc] initWithContentViewController:nav]; [tempPop presentPopoverFromBarButtonItem:mainButtonItem permittedArrowDirections:UIPopoverArrowDirectionUp animated:NO]; </code></pre> <p><strong>EDIT:</strong> I have resolved this problem: </p> <pre><code>+ (void)configure:(UINavigationController *)navController { UINavigationBar *navigationBar = navController.navigationBar; UIView *contentView = nil; for (UIView *view in navController.view.subviews) { if ([[NSString stringWithFormat:@"%@", [view class]] isEqualToString:@"UILayoutContainerView"]) contentView = view; } // setting frame to navigation bar and content 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 + navigationBar.frame.size.height)]; [navController.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>
 

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