因此,我的应用有一个徽标,该徽标在iOS 9.3.5上显示为附加在导航栏的底部,但iOS 11似乎增加了下边距。您可以在屏幕截图上看到它:
我用以下代码添加徽标:
UIImage* imgAct = [UIImage imageNamed: @"icon.png"];
UIButton *viewAct = [UIButton buttonWithType:UIButtonTypeCustom];
[viewAct setImage:imgAct forState:UIControlStateNormal];
[viewAct setImage:imgAct forState:UIControlStateHighlighted];
[viewAct.imageView setContentMode:UIViewContentModeScaleAspectFit];
viewAct.frame = CGRectMake(0.0, 0.0, 120, 48);
[viewAct setBackgroundColor:[UIColor whiteColor]];
UIBarButtonItem *btnAct = [[UIBarButtonItem alloc] initWithCustomView:viewAct];
UIImage *btnBg = [[UIImage imageNamed:@"white_pixel"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[btnAct setBackgroundImage:btnBg forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[array addObject:btnAct];
self.navigationItem.leftBarButtonItems = array;
是否可以删除此空白或将我的徽标附加到iOS 11的底部?该应用程序很旧,并且不使用自动布局,所有导航栏都是以编程方式制作的。