摘要: 1.NSNotification:消息或通知有三个成员变量- (NSString *)name;- (id)object;- (NSDictionary *)userInfo;通知名称:name,消息发送者:object,代理在收到NSNotification方法里,可以回调到object附加信息:userInfo2.NSNotificationCenter:消息中心单例模式,需要通过以下类方法访问[NSNotificationCenter defaultCenter]3.广播一个通知[[NSNotificationCenter defaultCenter] postNotificationN 阅读全文
posted @ 2012-03-26 14:06 月光的尽头 阅读(2956) 评论(0) 推荐(0)
摘要: 1.声明一个定时器变量NSTimer *_timer;2.启动一个定时器- (void)startTimer{ _timer = [[NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(onTimer) userInfo:nil repeats:NO] retain];}定时时间30秒,30秒后调用self的onTimer方法,执行定时操作,不重复3.停止或中断定时器- (void)stopTimer{ if(_timer != nil){ [_timer invalidat... 阅读全文
posted @ 2012-03-26 13:14 月光的尽头 阅读(1922) 评论(0) 推荐(1)