UINavigationController风格
我在代码中创建了UINavigationController,但我想将样式更改为黑色半透明
FirstViewController *fvc = [[FirstViewControlelr alloc] init];
UINavigationController *navcon = [[UINavigationController alloc] init];
navcon.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
[navcon pushViewController:fvc animated:NO];
[self.window addSubview:navcon.view];
[self.window makeKeyAndVisible];
return YES;
但他没有更改。请帮助我!
I created in code UINavigationController, but I want to change style to black translucent
FirstViewController *fvc = [[FirstViewControlelr alloc] init];
UINavigationController *navcon = [[UINavigationController alloc] init];
navcon.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
[navcon pushViewController:fvc animated:NO];
[self.window addSubview:navcon.view];
[self.window makeKeyAndVisible];
return YES;
But he doesn't change. Help me please!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑这与您正在访问导航控制器的导航控制器有关。您的导航控制器不在另一个导航控制器中,因此您正在设置不存在的内容的栏样式。
您想要这样:
您还可以创建一个导航控制器并立即使用根视图控制器初始化它,这样您就不必手动将其推入,如下所示:
是的,您忘记释放
fvc
在你自己的代码中。I suspect it has something to do with the fact that you're accessing a navigation controller's navigation controller. Your navigation controller doesn't live in another navigation controller, so you're setting the bar style of something that isn't there.
You want this:
Also you can make a navigation controller and immediately initialize it with a root view controller so you don't have to push it in manually, like this:
And yes, you forgot to release
fvc
in your own code.