Object-C-selector
Shape *shape=[[Shape alloc]init];
//[shape draw]
SEL selDraw=@selector(draw);
[shape performSelector:selDraw];
[shape performSelector:@selector(draw:)withObject:@"red"];
[shape performSelector:@selector(draw:andType:)withObject:@"yellow" withObject:@"circle"];
respondsToSelector:
if([shape respondsToSelector:@selector(draw)])判断时候存在这个方法
NSStringFromSelector:
NSLog(@"%@",NSStringFromSelector(selraw))//打印 draw
好处作为函数指针,方便消息传递
Cocoa 中很多系统采用@selector进行参数传递