2009-10-06 75 views
2

我已经尝试设置UINavigationBar的风格是在我的控制器的viewDidLoad方法半透明风格。但没有什么改变。为什么?在viewDidLoad中设置UINavigationBar的性质不做任何

我设置使用标准代码属性像

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; 
+1

很难说没有看到你的代码什么。确保你的UINavigation栏对象是有效的(不是零)... – Vladimir 2009-10-06 15:07:59

回答

4

根据Apple documentation

UIBarStyleBlackTranslucent已被弃用。使用UIBarStyleBlack并将半透明属性设置为YES。

1

刚刚有同样的问题 - 苹果文档是一个有点含糊 - 这里的解决方案

navigationController.navigationBar.barStyle = UIBarStyleBlack;

navigationContoller.navigationBar.translucent = YES;

+0

只是注意到你的代码上面,你需要添加它作为子视图(通常是“父”视图),你可能不想把它作为一个实例变量,因为它被添加为一个子视图,在该子视图中它将被自动释放。 – Paul 2010-04-12 06:18:53

0
UIBarStyleBlackTranslucent 
Deprecated. Use UIBarStyleBlack and set the translucent property to YES instead. 
Available in iPhone OS 2.0 and later. 
Declared in UIInterface.h. 
相关问题