【发布时间】:2013-09-27 18:31:18
【问题描述】:
当你只有一个代理对象时,有什么方法可以测试选择器/方法?
/* Proxy which may forward
* the method to some other object */
id proxy = [UINavigationBar appearance];
/* This condition returns FALSE
* despite the fact that the method would have otherwise been
* successfully executed at its destination */
if([proxy respondsToSelector:@selector(setBarTintColor:)]){
[proxy setBarTintColor:color];
}
【问题讨论】:
-
@maddy 这就是为什么我试图找到一种方法来在调用它之前测试方法调用是否会成功——而不是让逻辑基于操作系统版本..
标签: ios objective-c uiappearance respondstoselector