zoukankan      html  css  js  c++  java
  • UIAlertView 点击按钮后控制其是否消失

    新建NotDismissAlertView类,继承UIAlertView。

    设置控制是否消失的标示符

    重写  在-(void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated代理方法里判断

    具体代码如下:

    NotDismissAlertView.h:

    #import@interface NotDismissAlertView : UIAlertView

    @property(nonatomic, assign) BOOL notDisMiss;

    @end

    --------------------------------------

    NotDismissAlertView.m:

    #import "NotDismissAlertView.h"

    @implementation NotDismissAlertView

    -(void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated {

    if (_notDisMiss)

    {

    return;

    }

    [super dismissWithClickedButtonIndex:buttonIndex animated:animated];

    }

    @end

    -------

    在初始化AlertView时设定其notDisMiss值即可

    NotDismissAlertView *updateAlert = [[NotDismissAlertView alloc] initWithTitle:@"新版本提示" message:[NSString stringWithFormat:@"更新日志:\n%@",changeLog] delegate:self cancelButtonTitle:@"前往下载" otherButtonTitles:nil, nil];

    updateAlert.notDisMiss = YES;

    [updateAlert show];



    在 ios 8 后 出现了 uialertviewcontroller ,用同样的方法也可以达到让弹框不消失的目的

    参考链接:
    http://www.jianshu.com/p/932b81524787
    https://www.jianshu.com/p/21f2dee72480
    https://bbs.csdn.net/topics/390193528

  • 相关阅读:
    Server 对象
    Response 对象
    bzoj 5252: [2018多省省队联测]林克卡特树
    bzoj 2167: 公交车站
    bzoj 5315: [Jsoi2018]防御网络
    bzoj 5319: [Jsoi2018]军训列队
    bzoj 4161: Shlw loves matrixI
    bzoj 4942: [Noi2017]整数
    bzoj 2648: SJY摆棋子
    kd-tree 小结
  • 原文地址:https://www.cnblogs.com/isItOk/p/7498840.html
Copyright © 2011-2022 走看看