UINavigation.title相关属性设置

来源:互联网 发布:国泰安数据库是免费吗 编辑:程序博客网 时间:2024/05/01 17:44

还可以通过titleTextAttriutes属性定制UIBarButton。setTitleTextAttributes:方法用一个NSDictionary参数指定所需选项:

UITextAttributeTextColor,定制文字颜色。

UITextAttributeTextShadowColor,定制文字的阴影色。

UITextAttributeTextShadowOffset,定制阴影的偏移位置。

UITextAttributeFont,定制文本字体。

 

// Settitletext attributes    

NSMutableDictionary *attributes= [[NSMutableDictionary alloc] init];

    

[attributessetValue:[UIColor blackColor] forKey:UITextAttributeTextColor];    

[attributessetValue:[UIColor whiteColor] forKey:UITextAttributeTextShadowColor];    

[attributessetValue:[NSValue valueWithUIOffset:UIOffsetMake(01)]forKey:UITextAttributeTextShadowOffset];    

[attributessetValue:[UIFont fontWithName:@"Verdana"size:0.0] forKey:UITextAttributeFont];      

[[UIBarButtonItemappearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];    

[attributesrelease];