zoukankan      html  css  js  c++  java
  • [置顶] ios 时间定时器 NSTimer应用demo

    原创文章,转载请注明出处:http://blog.csdn.net/donny_zhang/article/details/9251917

    demo功能:ios NSTimer应用demo 。iphone6.1 测试通过。

    demo说明: ios中的时间定时器 NSTimer,他用来完成程序的定时功能,他需要三个主要的参数:时间间隔NSTimeInterval浮点型,事件代理delegate和事件处理方法@selector();本例用NSTimer来取消一个程序弹出的对话框。

    demo截屏:

     


    demo主要代码:

    - (void) performDismiss: (NSTimer *)timer
    {
        //定时器调用的处理方法,作用是隐藏提示框
    	[baseAlert dismissWithClickedButtonIndex:0 animated:NO];
    	[baseAlert release];
    	baseAlert = NULL;
    }
    
    - (void) presentSheet
    {
        //定义提示框信息
    	baseAlert = [[UIAlertView alloc] 
    							  initWithTitle:@"Alert" message:@"
    Message 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];
    }
    


    demo下载地址:
    http://download.csdn.net/detail/donny_zhang/5724197



  • 相关阅读:
    jar 常用操作
    linux 加载新的磁盘(卷组)
    apache 代理配置
    spring boot datasource 参数设置
    svn 常用命令
    最详细的maven教程
    centos 用户组操作
    ubuntu命令行操作mysql常用操作
    Ruby-Clamp
    maven使用备忘
  • 原文地址:https://www.cnblogs.com/dyllove98/p/3180276.html
Copyright © 2011-2022 走看看