を変更したいUINavigationBar
titleColor
。
の も変更したいtextColor
ですUINavigationBar
backButton
。
iPhone OS SDK 3.1.2 を使用しています
を変更したいUINavigationBar
titleColor
。
の も変更したいtextColor
ですUINavigationBar
backButton
。
iPhone OS SDK 3.1.2 を使用しています
この質問の一部はすでに回答されています。
次に、戻るボタンのタイトルの色を変更するには、ラベル付きのカスタム ボタンを作成することをお勧めします。
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:yourViewWithColoredText];
navigationItem.leftBarButtonItem = buttonItem; // assign it as the left button
yourViewWithColoredText
色付きのテキストを含むカスタム ビューにする必要があります。次に、必要に応じて、標準の戻るボタンのように見せることができます。
iOS 5 & 6title
でオンに設定UINavigationBar
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:UITextAttributeTextColor]];
iOS 7 の場合
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor blackColor]};
textColor
すべてオンに設定UIBarButtonItem
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor, nil];
[[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState: UIControlStateNormal];
UINavigationBar.h で次のように定義された titleView を設定できます。
@property(nonatomic,retain) UIView *titleView;
// Custom view to use in lieu of a title. May be sized horizontally. Only used when item is topmost on the stack.
そこに独自の UILabel を好きな色でポップします。