如何更改垃圾按钮' Objective-C中的颜色?

时间:2015-03-27 04:48:01

标签: ios objective-c xcode

我有这个代码,它在导航栏上创建了一个蓝色垃圾桶图标,我想将此图标的颜色更改为黑色。我该怎么做? 这是我的代码:

//add trash button to navigation bar
    UIBarButtonItem *myTrash = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemTrash
                                                                             target: self
                                                                            action: @selector(deleteHandler)];

    NSArray* barButtons = [self.navigationItem.rightBarButtonItems arrayByAddingObject: myTrash];
    self.navigationItem.rightBarButtonItems = barButtons;

1 个答案:

答案 0 :(得分:1)

您可以尝试更改整个窗口的色调(这将帮助您实现一致的色彩主题):

self.window.tintColor = [UIColor blackColor];

或导航栏的外观:

[UINavigationBar appearance].tintColor = [UIColor blackColor];