简体   繁体   中英

How to customize the text color of navigationbar

I am trying to change the color of the text that is the title of the navigationbar in UINavigation bar's drawRectangle and it hasn't worked so far. I am also wondering if it is possible to change the height of the bar in any way?

You could add a UILabel with the color you want and add it to the navigationbar instead of using the default title field.

titleView A custom view displayed in the center of the navigation bar when this item is the top item.

@property(nonatomic, retain) UIView *titleView Discussion If this property value is nil, the navigation item's title is displayed in the center of the navigation bar when this item is the top item. If you set this property to a custom title, it is displayed instead of the title. This property is ignored if leftBarButtonItem is not nil.

Custom views can contain buttons. Use the buttonWithType: method in UIButton class to add buttons to your custom view in the style of the navigation bar. Custom title views are centered on the navigation bar and may be resized to fit.

The default value is nil.

Availability Available in iOS 2.0 and later. Declared In UINavigationBar.h

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UINavigationItem_Class/Reference/UINavigationItem.html%23//apple_ref/doc/uid/TP40006933

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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