设为首页 加入收藏

TOP

iOS开发-简单工厂模式与OC反射机制(二)
2015-08-31 21:24:48 来源: 作者: 【 】 浏览:67
Tags:iOS 开发 简单 工厂 模式 反射 机制
student performSelector:@selector(test1)];


6. 间接调用student的test2方法(test2有一个参数)


// - (id)performSelector:(SEL)aSelector withObject:(id)object;? ? ? ?
[student performSelector:@selector(test2:) withObject:@"123"];? ? ?
?
// 最多带两个参数? ? ? ?
//- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;


7. 延迟2s调用student的test1方法


(在命令行没有延迟效果,因为命令行执行完后就退出main函数了 ,在IOS部分main函数一直在执行,所以可以看到延迟效果)


// - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;? ? ? ?
// delay单位为(秒)? ? ? ?
[student performSelector:@selector(test2:) withObject:@"123" afterDelay:2];


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇iOS开发-Launch Image和Launch Sc.. 下一篇使用C/C++扩展Python

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: