1. 程式人生 > >改動UINavigationBar (導航欄)上NavigationBarItem 的字體大小和顏色的用法

改動UINavigationBar (導航欄)上NavigationBarItem 的字體大小和顏色的用法

track dict enc all attr trac rst bject gin

//創建一個左邊button

UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithTitle:@"<" style:UIBarButtonItemStylePlain target:self action:@selector(clickLeftButton)];

// leftButton.


[leftButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:

[UIFont

fontWithName:@"Helvetica-Bold" size:17.0], NSFontAttributeName,

[UIColor greenColor], NSForegroundColorAttributeName,

nil]

forState:UIControlStateNormal];

//創建一個右邊button

UIBarButtonItem

*rightButton = [[UIBarButtonItem alloc] initWithTitle:@"登陸" style:UIBarButtonItemStyleDone target:self action:@selector(clickRightButton)];

[rightButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:

[UIFont fontWithName:@"Helvetica-Bold"

size:17.0], NSFontAttributeName,

[UIColor greenColor], NSForegroundColorAttributeName,

nil]

forState:UIControlStateNormal];


改動UINavigationBar (導航欄)上NavigationBarItem 的字體大小和顏色的用法