gpt4 book ai didi

iphone - 如何自定义导航栏的文字颜色

转载 作者:行者123 更新时间:2023-11-28 23:15:43 24 4
gpt4 key购买 nike

我正在尝试更改 UINavigation 栏的 drawRectangle 中导航栏标题文本的颜色,但到目前为止还没有成功。我还想知道是否可以通过任何方式更改栏的高度?

最佳答案

您可以添加一个具有所需颜色的 UILabel 并将其添加到导航栏,而不是使用默认的标题字段。

标题 View 当此项位于顶部时,在导航栏中央显示的自定义 View 。

@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

关于iphone - 如何自定义导航栏的文字颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6527005/

24 4 0