使用类代理自定义UIButton的外观时,UIBarItems似乎最初采用为UIButton设置的自定义属性.
使用Core Data从默认的Master/Detail项目开始.在AppDelegate中自定义UIButton的外观并运行应用程序.单击编辑按钮,然后单击MasterViewController导航栏中的完成按钮,并观察自定义消失.
[AppDelegate application:didFinishLaunchingWithOptions]中的自定义外观代码:
UIImage *customBackground = [[UIImage imageNamed:@"yourcustomimage.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5,5,5,5)];
[[UIButton appearance] setBackgroundImage:customBackground forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

所有UIBarButtonItems都使用自定义背景进行初始化

当"编辑"按钮被"完成"按钮替换时,它正确地没有自定义背景.
类似的问题询问如何自定义"完成"按钮.我担心为什么会发生UIBarItem对象,这些对象不是从UIButton继承的,并且想知道如何纠正它.
我怀疑代理继承和支持的属性,但我不知道如何纠正它.有什么建议?