UIBarButtonItemStyleDone background image using the iOS 5 appearance API

一曲冷凌霜 提交于 2019-12-03 14:44:17

I'm not sure why this was never answered but if you are still looking then simply create a property for a BarButtonItem in your .h, assign it in IB, then set the background property of that barButtonItem. Works fine for me and never "changes back to default appearance".

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.barButton setBackgroundImage:[UIImage imageNamed:@"YOURIMAGE"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}
Molotoff

I have just found and posted a possible solution to this problem. You can 'inject' custom styles using a UIBarButtonItem category:

Customizing UIBarButtonItem "Done" style and "Plain" style separately using UIAppearance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!