// // KDPServiceView.m // KuDianProject // // Created by 学丽 on 2019/7/12. // Copyright © 2019 KDP. All rights reserved. // #import "KDPServiceView.h" @implementation KDPServiceView -(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.4]; UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 281, 286)]; backV.backgroundColor=[UIColor whiteColor]; backV.layer.cornerRadius=9; backV.layer.masksToBounds=YES; [self addSubview:backV]; backV.center=self.center; UIImageView *imgv=[[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2-32, backV.top-32, 64, 64)]; imgv.image=[UIImage imageNamed:@"serviece_icon"]; [self addSubview:imgv]; UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, 54, backV.width, 25)]; label.textAlignment=NSTextAlignmentCenter; label.text=@"使用酷店的三个步骤:"; label.textColor=[UIColor colorWithHexString:fontColor]; label.font=[UIFont systemFontOfSize:18]; [backV addSubview:label]; UILabel *contentL=[[UILabel alloc]initWithFrame:CGRectMake(69, label.bottom+21, 150, 75)]; contentL.font=[UIFont systemFontOfSize:15]; contentL.numberOfLines=3; contentL.textAlignment=NSTextAlignmentCenter; contentL.textColor=[UIColor colorWithHexString:fontColor]; [backV addSubview:contentL]; NSString *contentstr=@"① 绑定快手小店Pid\n② 将商品推广到快手\n③ 查看订单和收益"; NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:contentstr]; NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle1 setLineSpacing:8]; [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [contentstr length])]; [contentL setAttributedText:attributedString1]; UIButton *buyButton=[[UIButton alloc]initWithFrame:CGRectMake(26, contentL.bottom+26, 230, 43)]; buyButton.layer.cornerRadius=21.5; buyButton.layer.masksToBounds=YES; [backV addSubview:buyButton]; buyButton.backgroundColor=[UIColor colorWithHexString:ThemeColor]; buyButton.titleLabel.font=[UIFont systemFontOfSize:14]; [buyButton setTitle:@"了解更多" forState:UIControlStateNormal]; [backV addSubview:buyButton]; [buyButton addTarget:self action:@selector(clickTBBtuuton) forControlEvents:UIControlEventTouchUpInside]; UIButton *kwaiBtn=[[UIButton alloc]initWithFrame:CGRectMake(26, buyButton.bottom+10, 230, 20)]; [kwaiBtn setTitle:@"跳过" forState:UIControlStateNormal]; kwaiBtn.titleLabel.font=[UIFont systemFontOfSize:14]; [kwaiBtn setTitleColor:[UIColor colorWithHexString:@"#666666"] forState:UIControlStateNormal]; [backV addSubview:kwaiBtn]; [kwaiBtn addTarget:self action:@selector(cancelButton) forControlEvents:UIControlEventTouchUpInside]; } return self; } -(void)cancelButton { [self removeFromSuperview]; } -(void)clickTBBtuuton { if (self.serviceBlock) { self.serviceBlock(); } } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self removeFromSuperview]; } @end