• 自定义选择提示框


    @property (nonatomic,strong) UIView * submitView;
    
    
    //创建自定义提示框
    - (void)viewDidLoad {
        [super viewDidLoad];
        _submitView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Main_Width, Main_height)];
        _submitView.hidden = YES;
        UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
        // 添加到窗口
        [window addSubview:_submitView];
        [self createSubmitView];
    }
    -(void)createSubmitView{
    
        _submitView.hidden = YES;;
        _submitView.backgroundColor = RGBACOLOR(0, 0, 0, 0.7);
        _submitView.layer.cornerRadius = 5;
        timer= [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(pushVC) userInfo:nil repeats:YES];
        [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
        
        submitTime = 5;
        
        UIView * view = [[UIView alloc]init];
        view.backgroundColor = WhiteColor;
        [_submitView addSubview:view];
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(_submitView.mas_centerX);
            make.size.mas_equalTo(CGSizeMake(231*kWidth, 115*kHeight));
            make.centerY.mas_equalTo(_submitView.mas_centerY);
        }];
        UILabel * labelSumit = [com createUIlabel:@"发车信息发布成功" andFont:FontOfSize15 andColor:YellowColor];
        [view addSubview:labelSumit];
        
        [labelSumit mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(view.mas_centerX);
            make.top.mas_equalTo(view.mas_top).with.offset(37*kHeight);
        }];
        UIView * line = [[UIView alloc]init];
        line.backgroundColor = GrayColor;
        [view addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(view.mas_centerX);
            make.top.mas_equalTo(view.mas_top).with.offset(77*kHeight);
            make.size.mas_equalTo(CGSizeMake(231*kWidth, 0.5));
        }];
        UIButton * btn1 = [self createBtn:@"继续发布"];
        btn1.layer.borderWidth = 0;
        [btn1 setTitleColor:littleBlackColor forState:UIControlStateNormal];
        btn1.tag = 66;
        [btn1 addTarget:self action:@selector(pressSubmitBtn:) forControlEvents:UIControlEventTouchUpInside];
    
        [view addSubview:btn1];
        [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(line.mas_top);
            make.size.mas_equalTo(CGSizeMake(231/2*kWidth, 38*kHeight));
            make.left.mas_equalTo(view.mas_left);
        }];
        UIButton * btn2 = [self createBtn:@"查看报价(5s)"];
        btn2.layer.borderWidth = 0;
        [btn2 setTitleColor:WhiteColor forState:UIControlStateNormal];
        btn2.tag = 67;
        btn2.backgroundColor = YellowColor;
        [btn2 addTarget:self action:@selector(pressSubmitBtn:) forControlEvents:UIControlEventTouchUpInside];
        
    
        [view addSubview:btn2];
        [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(line.mas_top);
            make.size.mas_equalTo(CGSizeMake(231/2*kWidth, 38*kHeight));
            make.right.mas_equalTo(view.mas_right);
        }];
    }
    
    //点击按钮  取消提示背景图的隐藏状态
    -(void)pressShipBtn{
       _submitView.hidden = NO;
       UIButton * btn = (UIButton*)[_submitView viewWithTag:67];
       NSString * string = [NSString stringWithFormat:@"查看报价(5s)"];
       [btn setTitle:string forState:UIControlStateNormal];
    }

  • 相关阅读:
    springboot系列九,springboot整合邮件服务、整合定时任务调度
    springboot系列八、springboot整合kafka
    springboot系列六、springboot配置错误页面及全局异常
    springboot系列五、springboot常用注解使用说明
    springboot系列四、配置模板引擎、配置热部署
    springboot系列三、springboot 单元测试、配置访问路径、多个配置文件和多环境配置,项目打包发布
    springboot系列二、springboot项目搭建
    springboot系列一、springboot产生背景及介绍
    kafka系列十、kafka常用管理命令
    Jmeter4.X
  • 原文地址:https://www.cnblogs.com/sayimba/p/5694088.html
Copyright © 2020-2023  润新知