zoukankan      html  css  js  c++  java
  • 关于UIAlertView弹出警告框自动消失

    很多事时候弹出框只是为了提示用户,为了避免让用户过多不必要的操作,让弹出框自动消失就可以了

    + (void)showDismissedAlertDialog:(NSString*)message {

        UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil   //NSLocalizedString(@"错误", nil)

                                                        message:NSLocalizedString(message, nil)

                                                       delegate:self

                                              cancelButtonTitle:nil

                                              otherButtonTitles:nil, nil];

            

        [NSTimer scheduledTimerWithTimeInterval:1.5f

                                         target:self

                                       selector:@selector(timerFireMethod:)

                                       userInfo:alert

                                        repeats:YES];    //弹出框消失倒计时

        

        [alert show];

    }

     

     

    #pragma mark -- 弹出框自动消失  使用倒计时

    + (void)timerFireMethod:(NSTimer*)theTimer//弹出框

    {

        

        UIAlertView *promptAlert = (UIAlertView*)[theTimer userInfo];

        

        [promptAlert dismissWithClickedButtonIndex:0 animated:NO];

        promptAlert = nil;

        

        [theTimer invalidate];//使计时器无效

    }

     

  • 相关阅读:
    CentOS7安装Oracle 11gR2 安装
    CentOS7 FTP服务搭建(虚拟用户访问FTP服务)
    .NET中RabbitMQ的使用
    ElasticSearch(站内搜索)
    SignalR 2.1 简单入门项目
    Oracl基础知识(一)
    CentOS6—HAProxy安装与配置
    Redis C#缓存的使用
    CentOS6— Redis安装(转和延续)
    Linux(CentOS)常用操作指令(二)
  • 原文地址:https://www.cnblogs.com/qwer-BHS/p/5315658.html
Copyright © 2011-2022 走看看