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

 //創建一個左邊按鈕

    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];

    //創建一個右邊按鈕

    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];


發佈了35 篇原創文章 · 獲贊 2 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章