2

を変更したいUINavigationBar titleColor

の も変更したいtextColorですUINavigationBar backButton

iPhone OS SDK 3.1.2 を使用しています

4

5 に答える 5

1

この質問の一部はすでに回答されています

次に、戻るボタンのタイトルの色を変更するには、ラベル付きのカスタム ボタンを作成することをお勧めします。

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:yourViewWithColoredText];
navigationItem.leftBarButtonItem = buttonItem; // assign it as the left button

yourViewWithColoredText色付きのテキストを含むカスタム ビューにする必要があります。次に、必要に応じて、標準の戻るボタンのように見せることができます。

于 2009-11-05T11:27:22.360 に答える
0

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];
于 2014-05-06T09:54:41.530 に答える
0

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 を好きな色でポップします。

于 2009-11-05T11:24:26.250 に答える