首页 > 代码库 > 修改UINavigationBar (导航栏)上NavigationBarItem 的字体大小和颜色的使用方法
修改UINavigationBar (导航栏)上NavigationBarItem 的字体大小和颜色的使用方法
//创建一个左边按钮
UIBarButtonItem *leftButton = [[UIBarButtonItemalloc] initWithTitle:@"<"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(clickLeftButton)];
// leftButton.
[leftButton setTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:
[UIFontfontWithName:@"Helvetica-Bold"size:17.0],NSFontAttributeName,
[UIColorgreenColor], NSForegroundColorAttributeName,
nil]
forState:UIControlStateNormal];
//创建一个右边按钮
UIBarButtonItem *rightButton = [[UIBarButtonItemalloc] initWithTitle:@"登陆"style:UIBarButtonItemStyleDonetarget:selfaction:@selector(clickRightButton)];
[rightButton setTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:
[UIFontfontWithName:@"Helvetica-Bold"size:17.0],NSFontAttributeName,
[UIColorgreenColor], NSForegroundColorAttributeName,
nil]
forState:UIControlStateNormal];
修改UINavigationBar (导航栏)上NavigationBarItem 的字体大小和颜色的使用方法