简体   繁体   English

在iPhone视图中更改标题的颜色和背景

[英]Change the color & background of title in iPhone view

i have a tab bar controller as a root controller. 我有一个标签栏控制器作为根控制器。 In its first tab I have a navigation controller containing an ungrouped table view 在其第一个选项卡中,我有一个包含未分组表视图的导航控制器

Screenshot is at - http://sankalplabs.files.wordpress.com/2011/04/screen-shot-2011-04-05-at-11-17-10-am.png 截图位于 - http://sankalplabs.files.wordpress.com/2011/04/screen-shot-2011-04-05-at-11-17-10-am.png

(Since I am new to this forum, its not allowing me to upload the image) (因为我是这个论坛的新手,不允许我上传图片)

Now i want to change the color & background of the title "Smart Analytics". 现在我想改变标题“Smart Analytics”的颜色和背景。 I tried using a label & placing it on the title. 我尝试使用标签并将其放在标题上。 But it has not worked. 但它没有奏效。 What is the way to do this ? 这样做的方法是什么?

self.navigationController.tintColor = [UIColor greenColor];
use this

self.navigationController.navigationBar.tintColor = [UIColor greenColor];

Try with titleView property of UINavigationItem 尝试使用UINavigationItem titleView属性

@property(nonatomic, retain) UIView *titleView

Can be accessed like below In UIViewController inherited class. 可以像下面一样访问UIViewController继承的类。

self.navigationItem.titleView = myOwnLabel;

Related SO post 相关的SO帖子

Changing the Title View of a UINavigationController UIViewController in Interface Builder 在Interface Builder中更改UINavigationController UIViewController的Title视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM