Objc中的 Selector与函数指针
12 Oct 2014定义
函数指针
int func(int arg) {
}
int (*pfunc)(int);
pfunc = func;
Selector
@interface cls
-(int) func : int arg
@end
SEL SFunc;
SFunc = @Selector(func:int);
调用
函数指针
pfunc(1);
Selector
cls *obj = [[cls alloc]init];
[obj performSelector : SFunc withObject : 1];