自定义选择提示框

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

转载于:https://www.cnblogs.com/sayimba/p/5694088.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值