Подтвердить что ты не робот

Как получить непрозрачный UINavigationBar на iOS 7

Есть ли способ сделать UINavigationBar, предназначенный для iOS 7, сплошным цветом без прозрачности? Я попытался установить backgroundColor, barTintColor, непрозрачный, прозрачный/полупрозрачный и т.д.... и ничего не работает.

Кто-нибудь знает, как это сделать?

Вот несколько фрагментов кода, который я использовал. Обратите внимание на свойства, которые я установил на navigationBar. Ни один из них в любом порядке или комбинации не работал.

@property (strong, nonatomic) UITabBarController *tabBarController;

testViewController = [[TestViewController alloc] init];
anotherViewController = [[AnotherViewController alloc] init];
navigationController = [[UINavigationController alloc]
                            initWithRootViewController:testViewController];

navigationController.navigationBar.barTintColor = [UIColor darkGrayColor;
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = YES;
navigationController.navigationBar.opaque = YES;

NSArray *tabBarViewControllers = [NSArray arrayWithObjects:
                                      navigationController,
                                      anotherViewController, nil];
self.tabBarController.viewControllers = tabBarViewControllers;
4b9b3361

Ответ 1

В списках кодов перечислены navigationController.navigationBar.translucent = YES;

Установите значение НЕТ.

Ответ 2

Чтобы сделать его полностью непрозрачным, вы можете просто изменить стиль панели навигации из самой части свойства!

Just set the style as Black!

Вот как это выглядит, когда u делает его черным

Ответ 3

Чтобы сделать все ваши навигационные панели непрозрачными, вы можете просто добавить UINavigationBar.appearance().translucent = false в application:didFinishLaunchingWithOptions:

Ответ 4

self.navigationController.navigationBar.isTranslucent = false