123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- //
- // ZBTBShareView.m
- // ZBProject
- //
- // Created by 学丽 on 2019/4/4.
- // Copyright © 2019 ZB. All rights reserved.
- //
- #import "ZBTBShareView.h"
- @implementation ZBTBShareView
- -(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(284);
- make.centerX.mas_equalTo(self.centerX);
- make.centerY.mas_equalTo(self.centerY);
- }];
- UIImageView *imgV =[[UIImageView alloc]init];
- imgV.image=[UIImage imageNamed:@"copy_sure"];
- [self.backV addSubview:imgV];
- [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.mas_equalTo(34);
- make.top.mas_equalTo(35);
- make.left.mas_equalTo(59);
- }];
- [self.backV addSubview:self.titleLabel];
- [self.backV addSubview:self.contentLabel];
- [self.backV addSubview:self.okBtn];
- [self.backV addSubview:self.tipeBtn];
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(35);
- make.height.mas_equalTo(34);
- make.left.mas_equalTo(imgV.mas_right).offset(5);
- make.right.mas_equalTo(-10);
-
- }];
-
- [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(24);
- make.height.mas_equalTo(52);
- make.left.mas_equalTo(20);
- make.right.mas_equalTo(-20);
- }];
-
- [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(30);
- make.right.mas_equalTo(-25);
- }];
-
- [self.tipeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(26);
- make.height.mas_equalTo(43);
- make.top.mas_equalTo(self.okBtn.mas_bottom).offset(5);
- make.right.mas_equalTo(-25);
- }];
- }
- return self;
- }
- -(void)setAlertDic:(NSDictionary *)alertDic
- {
- _alertDic = alertDic;
- self.contentLabel.text=[NSString stringWithFormat:@"淘口令%@已复制你可以用来分享、购买或推广",alertDic[@"tkl"]];
- }
- -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
- {
- [UIView animateWithDuration:0.3 animations:^{
- self.hidden=YES;
- }];
- }
- -(UIView *)backV
- {
- if (!_backV) {
- _backV =[[UIView alloc]init];
- _backV.backgroundColor=[UIColor whiteColor];
- _backV.layer.cornerRadius=9;
- _backV.layer.masksToBounds=YES;
- }
- return _backV;
- }
- -(UILabel *)titleLabel
- {
- if (!_titleLabel ) {
- _titleLabel=[[UILabel alloc]init];
- _titleLabel.textColor=[UIColor YHColorWithHex:0xFF5400];
- _titleLabel.font=[UIFont boldSystemFontOfSize:20];
- _titleLabel.text=@"淘口令已复制";
-
- }
- return _titleLabel;
- }
- -(UILabel *)contentLabel
- {
- if (!_contentLabel) {
- _contentLabel=[[UILabel alloc]init];
- _contentLabel.textColor=[UIColor YHColorWithHex:0x333333];
- _contentLabel.font=[UIFont systemFontOfSize:15];
- _contentLabel.numberOfLines=2;
- _contentLabel.text=@"正在为您创建快手小店Pid, 在快手上填写该Pid才能获得卖货收益"; _contentLabel.textAlignment=NSTextAlignmentCenter;
- }
- return _contentLabel;
- }
- -(UIButton *)okBtn
- {
- if (!_okBtn) {
- _okBtn =[[UIButton alloc]init];
- _okBtn.backgroundColor=[UIColor gradientWidthFromColor:[UIColor YHColorWithHex:0xFF8300] toColor:[UIColor YHColorWithHex:0xFF5200] withWidth:230];
- [_okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- _okBtn.titleLabel.font=[UIFont systemFontOfSize:15];
- [_okBtn setTitle:@"打开淘宝购买" forState:UIControlStateNormal];
- _okBtn.layer.cornerRadius=4;
- _okBtn.layer.masksToBounds=YES;
- [_okBtn addTarget:self action:@selector(clickOpentb) forControlEvents:UIControlEventTouchUpInside];
- }
- return _okBtn;
- }
- -(UIButton *)tipeBtn
- {
- if (!_tipeBtn) {
- _tipeBtn =[[UIButton alloc]init];
- _tipeBtn.backgroundColor=[UIColor clearColor];
- [_tipeBtn setTitleColor:[UIColor YHColorWithHex:0x9B9B9B] forState:UIControlStateNormal];
- _tipeBtn.titleLabel.font=[UIFont systemFontOfSize:15];
- [_tipeBtn setTitle:@"推广到快手" forState:UIControlStateNormal];
- _tipeBtn.layer.cornerRadius=4;
- _tipeBtn.layer.masksToBounds=YES;
- [_tipeBtn addTarget:self action:@selector(clickTipe) forControlEvents:UIControlEventTouchUpInside];
-
- }
- return _tipeBtn;
- }
- -(void)clickOpentb
- {
- if (![PublicFunction canOpenURL:@"taobao://"]) {
- [MBProgressHUD showTip:TBTipe];
- return;
- }
- UIPasteboard * pastboard = [UIPasteboard generalPasteboard];
- pastboard.string=_alertDic[@"tkl"];
- // [self jumpKuaishouWithstr:json[@"data"][@"tkl"]];
- NSString* taobao = [NSString stringWithFormat:@"taobao://"];
- UIWebView* webview = [[UIWebView alloc]initWithFrame:CGRectZero];
- [[UIApplication sharedApplication].keyWindow addSubview:webview];
- NSURL*url = [NSURL URLWithString:taobao];
- NSURLRequest *request = [NSURLRequest requestWithURL:url];
- [webview loadRequest:request];
- }
- #pragma mark---推广到快手
- -(void)clickTipe
- {
- // [PublicFunction jumpKuaishouWithstr:self.alertDic[@"kwai_url_prime"]];
- if (![PublicFunction canOpenURL:kwaiUrl]) {
- [MBProgressHUD showTip:KWaiTipe];
- return;
- }
- NSString* taobao = [NSString stringWithFormat:kwaiUrl];
- UIWebView* webview = [[UIWebView alloc]initWithFrame:CGRectZero];
- [[UIApplication sharedApplication].keyWindow addSubview:webview];
- NSURL*url = [NSURL URLWithString:taobao];
- NSURLRequest *request = [NSURLRequest requestWithURL:url];
- [webview loadRequest:request];
- self.hidden=YES;
- }
- @end
|