123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- //
- // ZBUseStep.m
- // ZBProject
- //
- // Created by 学丽 on 2019/4/11.
- // Copyright © 2019 ZB. All rights reserved.
- //
- #import "ZBUseStep.h"
- @implementation ZBUseStep
- -(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];
-
- UIView *backV =[[UIView alloc]init];
- backV.backgroundColor=[UIColor whiteColor];
- backV.layer.cornerRadius=9;
- backV.layer.masksToBounds=YES;
- [self addSubview:backV];
-
- UIImageView *headIm =[[UIImageView alloc]init];
- [headIm setImage:[UIImage imageNamed:@"kefu_head"]];
- headIm.layer.cornerRadius=32.5;
- headIm.layer.masksToBounds=YES;
- [self addSubview:headIm];
- [headIm mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.mas_equalTo(65);
- make.centerX.mas_equalTo(backV.mas_centerX);
- make.top.mas_equalTo(backV.mas_top).offset(-32.5);
- }];
-
- [backV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(281);
- make.height.mas_equalTo(286);
- make.centerX.mas_equalTo(self.centerX);
- make.centerY.mas_equalTo(self.centerY);
- }];
-
- [backV addSubview:self.titleLabel];
- [backV addSubview:self.contentLabel];
- [backV addSubview:self.okBtn];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(headIm.mas_bottom).offset(22);
- 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(70);
- make.right.mas_equalTo(-70);
- }];
-
- [self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(26);
- make.height.mas_equalTo(43);
- make.top.mas_equalTo(self.contentLabel.mas_bottom).offset(25);
- make.right.mas_equalTo(-25);
- }];
-
- UIButton *skipBtn=[[UIButton alloc]init];
- [backV addSubview:skipBtn];
- [skipBtn setTitle:@"跳过" forState:UIControlStateNormal];
- [skipBtn setTitleColor:[UIColor YHColorWithHex:0xB7B7B7] forState:UIControlStateNormal];
- skipBtn.titleLabel.font=[UIFont systemFontOfSize:16];
- [skipBtn addTarget:self action:@selector(skipClickBtn) forControlEvents:UIControlEventTouchUpInside];
- [skipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(26);
- make.height.mas_equalTo(33);
- make.top.mas_equalTo(self.okBtn.mas_bottom).offset(5);
- make.right.mas_equalTo(-25);
- }];
-
- }
- return self;
- }
- -(void)skipClickBtn
- {
- [self removeFromSuperview];
- }
- -(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;
- }
- -(UILabel *)contentLabel
- {
- if (!_contentLabel) {
- _contentLabel=[[UILabel alloc]init];
- _contentLabel.textColor=[UIColor YHColorWithHex:0x333333];
- _contentLabel.font=[UIFont systemFontOfSize:14];
- _contentLabel.numberOfLines=0;
-
- NSString *str=@"① 绑定快手小店Pid \n② 将商品推广到快手\n③ 查看订单和收益";
- 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];
-
-
- }
- return _contentLabel;
- }
- -(UIButton *)okBtn
- {
- if (!_okBtn) {
- _okBtn =[[UIButton alloc]init];
-
- [_okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- _okBtn.titleLabel.font=[UIFont systemFontOfSize:15];
- _okBtn.layer.cornerRadius=21.5;
- _okBtn.layer.masksToBounds=YES;
- _okBtn.backgroundColor=[UIColor gradientWidthFromColor:[UIColor YHColorWithHex:0xFF8300] toColor:[UIColor YHColorWithHex:0xFF5200] withWidth:230];
- [_okBtn setTitle:@"了解更多" forState:UIControlStateNormal];
- [_okBtn addTarget:self action:@selector(clickOpentb) forControlEvents:UIControlEventTouchUpInside];
- }
- return _okBtn;
- }
- -(void)clickOpentb
- {
- if (self.stepBlock) {
- self.stepBlock();
- }
- [self removeFromSuperview];
-
- }
- @end
|