SEL数据类型
2016-12-14 10:48 supper_Ho 阅读(253) 评论(0) 编辑 收藏 举报
//
// main.m
// 06-SEL数据类型
//
// Created by apple on 14-3-18.
// Copyright (c) 2014年 apple. All rights reserved.
//
#import <Foundation/Foundation.h>
/*
SEL数据类型是用来包装方法的
*/
#import "Person.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
Person * p = [[Person alloc] init];
//消息机制
// [p eat];
/*
//使用@selector就能够把一个方法包装成 SEL数据类型
SEL s1 = @selector(eat);
[p performSelector:s1];
SEL s2 = @selector(call:);
[p performSelector:s2 withObject:@"135047654"];
SEL s3 = @selector(findName);
NSString * str = [p performSelector:s3];
NSLog(@"%@",str);
*/
// [p performSelector:@selector(eat)];
[p performSelector:@selector(abc)];
[p eat];
}
return 0;
}