Rob*_*Rob 9 objective-c uinavigationbar ios uiappearance
在我的AppDelegate中,我使用UIAppearance使用以下代码设置我自己的NavigationBar:
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav5.png"] forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
但是我的应用程序的一些视图不需要它.我怎样才能摆脱它,所以我只能在相关的观点中使用IB?
cal*_*kus 12
您不需要使用代理.只需获得实际的navigationBar,它应该看起来不同并直接在其上设置颜色.
[navigationBarInstance setTintColor:[UIColor blackColor]];
[navigationBarInstance setBackgroundImage:[UIImage imageNamed:@"nav5.png"] forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
您也可以将两个值都设置为nil,再次需要标准样式.(测试Ben Clayton).
[navigationBarInstance setTintColor:nil];
[navigationBarInstance setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1316 次 |
| 最近记录: |