-1

我在导航栏上有一个完成按钮,我想让它显示为蓝色。但只是做以下似乎没有帮助。我在这里想念什么?我知道如果导航栏为黑色,按钮将自动显示为蓝色,但我不希望此视图控制器上导航栏的颜色为黑色。

- (UIBarButtonItem *)doneButton {
    UIBarButtonItem *doneButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done" 
                                                                    style:UIBarButtonItemStyleDone 
                                                                   target:self 
                                                                   action:@selector(done:)] autorelease];

    return doneButton;
}
4

2 回答 2

0

Changing combination of NavigationBar and BarItems appearance is not easy tasks before iOS5.

Standard way is to subclass NavigationBar. This nice sample code may help, even if not directly.

In iOS5, you can use "appearance proxy". Nice tutorial is here

于 2011-12-27T01:14:13.857 回答
0

You don't need to define your own done button. As long as it's called 'done' you can use the predefined barbuttonsystemitemdone:

   [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone Target:...
于 2011-12-26T23:20:51.100 回答