123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- //
- // ZBTipeView.m
- // ZBProject
- //
- // Created by 学丽 on 2019/4/9.
- // Copyright © 2019 ZB. All rights reserved.
- //
- #import "ZBTipeView.h"
- @implementation ZBTipeView
- -(instancetype)initWithFrame:(CGRect)frame
- {
- self =[super initWithFrame:frame];
- if (self) {
- self.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.5];
-
-
- [self addSubview:self.backV];
- [self.backV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(281);
- make.height.mas_equalTo(303);
- make.centerX.mas_equalTo(self.centerX);
- make.centerY.mas_equalTo(self.centerY);
- }];
-
- [self.backV addSubview:self.titleLabel];
- [self.backV addSubview:self.contentLabel];
- [self.backV addSubview:self.okBtn];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(23);
- make.height.mas_equalTo(34);
- make.left.mas_equalTo(10);
- make.right.mas_equalTo(-10);
-
- }];
-
- [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(14);
-
- make.left.mas_equalTo(20);
- make.right.mas_equalTo(-20);
- }];
-
- [self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(86);
- make.height.mas_equalTo(33);
- make.top.mas_equalTo(self.contentLabel.mas_bottom).offset(25);
- make.right.mas_equalTo(-85);
- }];
-
- }
- return self;
- }
- -(UILabel *)titleLabel
- {
- if (!_titleLabel ) {
- _titleLabel=[[UILabel alloc]init];
- _titleLabel.textColor=[UIColor YHColorWithHex:0x333333];
- _titleLabel.font=[UIFont boldSystemFontOfSize:18];
- _titleLabel.textAlignment=NSTextAlignmentCenter;
- _titleLabel.text=@"预估收益";
-
- }
- return _titleLabel;
- }
- -(UIView *)backV
- {
- if (!_backV) {
- _backV =[[UIView alloc]init];
- _backV.backgroundColor=[UIColor whiteColor];
- _backV.layer.cornerRadius=9;
- _backV.layer.masksToBounds=YES;
- }
- return _backV;
- }
- -(UILabel *)contentLabel
- {
- if (!_contentLabel) {
- _contentLabel=[[UILabel alloc]init];
- _contentLabel.textColor=[UIColor YHColorWithHex:0x333333];
- _contentLabel.font=[UIFont systemFontOfSize:15];
- _contentLabel.numberOfLines=0;
- NSString *str=@"• 总预估收益是指所有已付款订单产生的收益\n• 每月预估算收益是指每个自然月内已付款订单产生的收益\n• 每天预估收益是指每天24小时内已付款订单产生的收益";
- NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:str];
- NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
- [paragraphStyle1 setLineSpacing:8];
- [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [str length])];
- [_contentLabel setAttributedText:attributedString1];
- [_contentLabel sizeToFit];
- // _contentLabel.text=@"• 总预估收益是指所有已付款订单产生的收益 \n• 每月预估算收益是指每个自然月内已付款订单产生的收益 \n• 每天预估收益是指每天24小时内已付款订单产生的收益";
- }
- return _contentLabel;
- }
- -(UIButton *)okBtn
- {
- if (!_okBtn) {
- _okBtn =[[UIButton alloc]init];
-
- [_okBtn setTitleColor:[UIColor baseColor] forState:UIControlStateNormal];
- _okBtn.titleLabel.font=[UIFont systemFontOfSize:15];
- _okBtn.layer.cornerRadius=8;
- _okBtn.layer.masksToBounds=YES;
- _okBtn.layer.borderColor=[UIColor baseColor].CGColor;
- _okBtn.layer.borderWidth=1;
- [_okBtn setTitle:@"知道了" forState:UIControlStateNormal];
- _okBtn.layer.cornerRadius=4;
- _okBtn.layer.masksToBounds=YES;
- [_okBtn addTarget:self action:@selector(clickOpentb) forControlEvents:UIControlEventTouchUpInside];
- }
- return _okBtn;
- }
- -(void)clickOpentb
- {
- self.hidden =YES;
- }
- @end
|