ios 时间定时器 NSTimer应用demo
来源:未知 责任编辑:责任编辑 发表时间:2014-03-23 22:26 点击:次
demo功能:ios NSTimer应用demo 。iphone6.1 测试通过。
demo说明: ios中的时间定时器 NSTimer,他用来完成程序的定时功能,他需要三个主要的参数:时间间隔NSTimeInterval浮点型,事件代理delegate和事件处理方法@selector();本例用NSTimer来取消一个程序弹出的对话框。
demo截屏:
demo主要代码:
<STRONG xmlns="http://www.w3.org/1999/xhtml">- (void) performDismiss: (NSTimer *)timer { //定时器调用的处理方法,作用是隐藏提示框 [baseAlert dismissWithClickedButtonIndex:0 animated:NO]; [baseAlert release]; baseAlert = NULL; } - (void) presentSheet { //定义提示框信息 baseAlert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"\nMessage to user with asynchronous information" delegate:self cancelButtonTitle:nil otherButtonTitles: nil]; //初始化一个定时器,三个主要参数是,时间间隔NSTimeInterval浮点型,事件代理 delegate和事件处理方法@selector() [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector: @selector(performDismiss:) userInfo:nil repeats:NO]; //显示提示框 [baseAlert show]; } </STRONG>
相关新闻>>
- 发表评论
-
- 最新评论 更多>>
今日头条
更多>>您可能感兴趣的文章
- Memory on the iPhone
- Android:实现TabWidget选项卡按钮在屏幕下方
- ios开发问题:添加库和复制其它工程文件编译错误问题
- (iPhone/iPad开发)presentViewController相应方法在SDK5.0前后
- iphone开发之object c基础一定义接口
- Lexical or Preprocessor Issue 'xxx.h
- iPhone应用开发之十一:常用的三种动画表现效果
- ios学习笔记(二)xcode 4.3.2下实现基本交互
- iPhone开发学习笔记006—— NSNotification自定义通知名
- 多线程之NSInvocationOperation