在我的应用程序代表中,我指定了一个透明工具栏(如问题18969248的答案中所建议的): -
代码是:
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
navigationBarAppearance.backgroundColor = [UIColor clearColor];
[navigationBarAppearance setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
navigationBarAppearance.shadowImage = [[UIImage alloc] init];
navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
这适用于推送到导航控制器堆栈的所有视图控制器,但不适用于根视图控制器(从NIB加载) . 如何在根视图控制器的导航栏中获得透明度?
1 回答
如果您使用的是故事板,也许您应该以这种方式通过AppDelegate以编程方式加载RootViewController: