123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // KDPSellingPointView.m
- // KuDianProject
- //
- // Created by 学丽 on 2019/7/9.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPSellingPointView.h"
- @implementation KDPSellingPointView
- -(instancetype)initWithFrame:(CGRect)frame
- {
- self =[super initWithFrame:frame];
- if (self) {
- self.hotView=[[UIView alloc]initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 0)];
- self.hotView.layer.cornerRadius=5;
- self.hotView.layer.masksToBounds=YES;
- [self addSubview:self.hotView];
- self.hotView.backgroundColor=[UIColor colorWithHexString:@"#FEF3E8"];
-
-
- UIImageView *iconIm=[[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 18, 18)];
- iconIm.image=[UIImage imageNamed:@"hot_point"];
- [self.hotView addSubview:iconIm];
-
- UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(iconIm.right+5, iconIm.top, 50, 18)];
- label.text=@"卖点:";
- label.font=[UIFont systemFontOfSize:13];
- label.textColor=[UIColor colorWithHexString:@"#333333"];
- [self.hotView addSubview:label];
-
-
- UIButton *copyBtn=[[UIButton alloc]initWithFrame:CGRectMake(self.hotView.right-70, iconIm.top+1, 50, 16)];
- copyBtn.layer.cornerRadius=2;
- copyBtn.layer.masksToBounds=YES;
- [copyBtn setTitle:@"复制" forState:UIControlStateNormal];
- [copyBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
- copyBtn.titleLabel.font=[UIFont systemFontOfSize:10];
- copyBtn.layer.borderWidth=1;
- copyBtn.layer.borderColor=[UIColor colorWithHexString:@"#999999"].CGColor;
- [self.hotView addSubview:copyBtn];
-
- [copyBtn addTarget:self action:@selector(copyclickButton) forControlEvents:UIControlEventTouchUpInside];
-
-
- self.pointLabel=[[UILabel alloc]initWithFrame:CGRectMake(10,label.bottom, SCREEN_WIDTH-40, 20)];
- self.pointLabel.text=@"----";
- self.pointLabel.numberOfLines=0;
- self.pointLabel.textColor=[UIColor colorWithHexString:@"#4A4A4A"];
- self.pointLabel.font=[UIFont systemFontOfSize:13];
- [self.hotView addSubview:self.pointLabel];
-
- }
- return self;
- }
- -(void)setPoint_good:(NSString *)point_good
- {
- _point_good = point_good;
- self.pointLabel.text=point_good;
- CGFloat height =[KDPublicMethod getHeightByWidth:SCREEN_WIDTH-40 title:point_good font:[UIFont systemFontOfSize:13]];
- self.hotView.frame=CGRectMake(10, 0, SCREEN_WIDTH-20, 45+height);
- self.pointLabel.frame=CGRectMake(10,28, SCREEN_WIDTH-40, 10+height);
-
- }
- #pragma mark---复制
- -(void)copyclickButton
- {
- UIPasteboard * pastboard = [UIPasteboard generalPasteboard];
- if (self.point_good) {
- pastboard.string =self.point_good;
- [MBProgressHUD showMessage:@"复制成功"];
-
- }else {
- [MBProgressHUD showMessage:@"复制失败"];
- }
- }
- @end
|