Я реализует простой UITabBar с 3 пунктов, используя фрагмент кода ниже:tvOS: UITabBarController необычное название появляется
- (void)setupTabBar
{
CamerasViewController *camerasViewController = [[CamerasViewController alloc] init];
camerasViewController.title = @"Cameras";
UINavigationController *camerasNavigationController = [[UINavigationController alloc] initWithRootViewController:camerasViewController];
_camerasNavigationController = camerasNavigationController;
DeliveriesViewController *deliveriesViewController = [[DeliveriesViewController alloc] init];
deliveriesViewController.title = @"Deliveries";
UINavigationController *deliveriesNavigationController = [[UINavigationController alloc] initWithRootViewController:deliveriesViewController];
_deliveriesNavigationController = deliveriesNavigationController;
LogoutViewController *logoutViewController = [[LogoutViewController alloc] init];
logoutViewController.title = @"Logout";
UINavigationController *logoutNavigationController = [[UINavigationController alloc] initWithRootViewController:logoutViewController];
_logoutNavigationController = logoutNavigationController;
[[UITabBarItem appearance] setTitleTextAttributes:@{
NSFontAttributeName: [Constants lightFontOfSize:[Constants menuBarHeight] * 0.29]
}
forState:UIControlStateNormal];
self.tabBar.backgroundColor = [Constants goldColor];
self.tabBar.tintColor = [UIColor whiteColor];
self.viewControllers = @[
_camerasNavigationController,
_deliveriesNavigationController,
_logoutNavigationController
];
self.tabBar.setNeedsFocusUpdate;
}
Когда оказывается, я вижу UITabBar отображается правильно. Однако, когда я красть вниз на пульте дистанционного управления, чтобы сосредоточиться на представлении (то есть сокрытие UITabBar) Я заметил, что вид название появляется в бесформатном шрифте, как показано на скриншотах ниже 2:
Удаление строк .title = @ "view-title-string" в приведенном выше коде очищает это, но затем я теряю заголовки в TabBar.
Есть ли у кого-нибудь рекомендации относительно того, как избавиться от этого названия? Я также попытался запустить следующий фрагмент кода на каждой из 3-х UIViewControllers, но не повезло:
for (UIView *v in self.view.subviews)
{
if ([v isKindOfClass:[UILabel class]])
{
[v removeFromSuperView];
}
}
Удаление UINavigationController под каждым UITabBar действительно решило проблему. Спасибо! – unicornherder