zoukankan      html  css  js  c++  java
  • 自定义选择提示框

    @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];
    }

  • 相关阅读:
    c#基础 里氏转换
    c#基础 base和this的区别,在继承上面
    c#基础值类和引用类型_字符串
    c# 基础字符串
    c#基础-构造函数 this new
    c#基础3-方法的重载静态和非静态,字段属性,方法
    c#基础2-out-ref
    .net的基础知识点
    Xamarin.Form的坑
    weboack 4 tutorial
  • 原文地址:https://www.cnblogs.com/sayimba/p/5694088.html
Copyright © 2011-2022 走看看