//SEL的第一种用法:
if 0
SEL sel; //1.声明一个SEL变量
sel = @selector(eat); //2.存储方法名
[per performSelector:sel]; //3.执行sel中存储的方法
endif
//SEL的第二种用法:SEL以参数形式出现
[per action:@selector(sleep)];
[per action:@selector(play)];
//SEL sel(形参) = @selector(sleep)(实参) //2.SEL存储方法名
-(void)action:(SEL)sel //1. 声明SEL
{
//判断SEL中的方法是否响应,如果响应,则进入执行
if([self respondsToSelector:sel])
{
[self performSelector:sel]; //3.执行sel中的方法
}else{
NSLog(@"没有响应");
}
}