2011-12-31 70 views
0

我希望我的導航欄使用黑色透明外觀。在我的非故事板的應用程序,我可以把這個代碼在AppDidFinishLoadingWithOptionsiPhone iOS5故事板更改導航欄外觀

[[UINavigationBar appearance] setTintColor:[AppColors navBarColor]]; 
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent]; 
[[UINavigationBar appearance] setAlpha:0.7]; 

[[[UITableView appearance] backgroundView]setBackgroundColor:[AppColors tableViewBackgroundColor]]; 
[[[UITableViewCell appearance] backgroundView]setBackgroundColor:[AppColors tableViewCellBackgroundColor]]; 

會在哪裏這段代碼去,如果我用一個故事板?看來我的控制器在應用程序啓動前加載

謝謝!

回答

1

這將繼續與故事板一起工作。 appearance類方法返回一個代理對象,該對象爲所有創建的該類實例定義樣式信息。

+0

doh!它的工作原理是一樣的:) – 2011-12-31 01:48:07

0

嘗試將它放入應用程序根視圖控制器中的viewDidLoad方法中。