0

ナビゲーションバーを次のようにオレンジ色に着色しました。

navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.88 green:0.52 blue:0.27 alpha:1];

すべてが正常に機能し、すべてのボタンはバーと同じくらいオレンジ色ですが、icがカスタムの右アイテムメニューに来ると、青色で表示されます。これはスクリーンショットです:http://img146.imageshack.us/img146/5605/schermata20091202a14565.png

これは正しいボタンのコードです:

UIView *container = [[UIView alloc] init];
UIToolbar *tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 80, 45)];

NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:2];

UIBarButtonItem *bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addGadget:)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];

bi = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"less.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(setEditing:)];
[buttons addObject:bi];
[bi release];

[tools setItems:buttons animated:NO];
[buttons release];

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];

すべてをオレンジ色にする方法は?

4

1 に答える 1

1

オブジェクトの を と同じに設定する必要がtintColorあります。UIToolbarUINavigationBar

UIToolbara は aと同じではないことに注意してくださいUINavigationBar。背景のグラデーション/色は少し異なります。UIToolbar の backgroundColor をに設定してみてください+[UIColor clearColor]

また、 containerは のサブクラスであるためUIView、おそらく必要さえないため、それ自体で customView として使用できます。UIToolbarUIView

于 2009-12-02T14:15:45.007 に答える