12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // HCShopCarAuthorView.m
- // hc
- //
- // Created by hc on 2018/11/7.
- // Copyright © 2018年 hc. All rights reserved.
- //
- #import "HCShopCarAuthorView.h"
- @implementation HCShopCarAuthorView
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
-
- UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, Fitsize(28))];
- topView.backgroundColor = [UIColor YHColorWithHex:0xFAE0E1];
- [self addSubview:topView];
-
- UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(10, Fitsize(8), Fitsize(15), Fitsize(15))];
- icon.image = [UIImage imageNamed:@"mijiIcon"];
- [topView addSubview:icon];
-
- UILabel *tip = [[UILabel alloc] initWithFrame:CGRectMake(15+Fitsize(15), 0, self.width-25-Fitsize(15), topView.height)];
- tip.text = @"省钱秘籍:淘宝购物车里的宝贝有你不知道的隐藏优惠券哦";
- tip.textColor = [UIColor YHColorWithHex:0xF4150D];
- tip.adjustsFontSizeToFitWidth = YES;
- [topView addSubview:tip];
-
- UILabel *text1 = [[UILabel alloc] initWithFrame:CGRectMake(0, Fitsize(90), 0, 0)];
- text1.text = @"授权登录";
- text1.textColor = [UIColor YHColorWithHex:0x333333];
- text1.font = [UIFont systemFontOfSize:16];
- [text1 sizeToFit];
- text1.centerX = self.centerX;
- [self addSubview:text1];
-
- UILabel *text2 = [[UILabel alloc] initWithFrame:CGRectMake(0, Fitsize(90), 0, 0)];
- text2.text = @"发现你淘宝购物车里的隐藏优惠券";
- text2.textColor = [UIColor YHColorWithHex:0x333333];
- text2.font = [UIFont systemFontOfSize:16];
- [text2 sizeToFit];
- text2.y = text1.bottom+5;
- text2.centerX = self.centerX;
- [self addSubview:text2];
-
- UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Fitsize(180), Fitsize(180)*281/331)];
- imgView.image = [UIImage imageNamed:@"authorQuan"];
- imgView.contentMode = UIViewContentModeScaleAspectFill;
- imgView.y = text2.bottom+Fitsize(40);
- imgView.centerX = self.centerX;
- [self addSubview:imgView];
-
- UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, imgView.bottom+Fitsize(30), Fitsize(160), Fitsize(36))];
- [btn setTitle:@"授权登录" forState:UIControlStateNormal];
- [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- btn.backgroundColor = [UIColor homeRedColor];
- btn.layer.cornerRadius = Fitsize(18);
- btn.titleLabel.font = [UIFont systemFontOfSize:16];
- [btn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
- btn.centerX = self.centerX;
- [self addSubview:btn];
-
- }
- - (void)clickBtn {
- if (self.clickBlock) {
- self.clickBlock();
- }
- }
- @end
|