添加以下代码利用外观上的操作系统的新版本,而没有做任何事情对旧版本:如何以编程方式检查外观代理?
if ([UINavigationBar respondsToSelector:@selector(appearance)])
{
[[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]];
它编译确定,似乎是工作。
然后我打开了一堆在Xcode中默认禁用的构建警告,并开始出现错误“Unimplemented selector'appearance'”。
那么如果外观存在,那么在运行时检查的正确方法是什么?