iOS 7之后更改導航欄字體顏色幾種方法

歲數大了,記憶不行了,還是爛筆頭靠譜,直接上代碼,以備后期自己使用
第一種:

    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    title.text = @"全國小記者互動平臺";
    title.font = kFont(18);
    title.textAlignment = NSTextAlignmentCenter;
    title.textColor = [UIColor whiteColor];
    // 給導航標題設置一個自定義View
    self.navigationItem.titleView = title;

第二種 比較簡單 推薦使用:

    // 直接獲取導航欄唯一對象
    UINavigationBar *bar = [UINavigationBar appearance];
    // bar.barTintColor = [UIColor redColor];
    // 設置標題顏色字典
    NSDictionary *dictAttr = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
    bar.titleTextAttributes = dictAttr;

第三種 后期在補:

  Loading......
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容