Короче говоря, в iOS10 левая и правая кнопки, пользовательская метка работает без проблем, в iOS11 ничего не отображается. Я читал в другом месте, что мне нужно добавить ограничения для кнопок, но это не помогает. Код, вызываемый в viewDidLoad()
.
self.connectionButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0,0.0,74.0,29.0)];
[self.connectionButton.widthAnchor constraintEqualToConstant:74].active = YES;
[self.connectionButton.heightAnchor constraintEqualToConstant:29].active = YES;
self.connectionButton.backgroundColor = [UIColor yellowColor];
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:self.connectionButton];
self.navigationItem.rightBarButtonItem = buttonItem;
Появление:
[[UINavigationBar appearance] setTranslucent:YES];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundColor:[UIColor clearColor]];
Когда я проверяю кадр во время выполнения, он правильный (0,0,74,29). Однако на панели не отображается кнопка.
XCode 9 beta 8 не работает ни на устройстве, ни на симуляторе.