1
This commit is contained in:
@@ -39,18 +39,6 @@
|
||||
#pragma mark - Layout
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
// 根据实际尺寸更新购买按钮背景的渐变图(避免在未布局前计算尺寸为0)
|
||||
if (self.buyButton.currentBackgroundImage == nil) {
|
||||
CGSize size = self.buyButton.bounds.size;
|
||||
if (size.width > 0 && size.height > 0) {
|
||||
UIImage *bg = [UIImage kb_gradientImageWithColors:@[[UIColor colorWithHex:0xE6FFF4], [UIColor colorWithHex:0xA6FFD8]]
|
||||
locations:nil
|
||||
size:size
|
||||
direction:KBGradientDirectionLeftToRight
|
||||
cornerRadius:size.height * 0.5];
|
||||
[self.buyButton setBackgroundImage:bg forState:UIControlStateNormal];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UI
|
||||
@@ -126,7 +114,7 @@
|
||||
[self.buyButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.mas_left).offset(62);
|
||||
make.right.equalTo(self.mas_right).offset(-62);
|
||||
make.bottom.equalTo(self.mas_bottom).offset(-5);
|
||||
make.bottom.equalTo(self.mas_bottom).offset(0);
|
||||
make.height.mas_equalTo(56);
|
||||
}];
|
||||
}
|
||||
@@ -240,7 +228,7 @@
|
||||
[_buyButton setTitle:@"Recharge Now" forState:UIControlStateNormal];
|
||||
[_buyButton setTitleColor:[UIColor colorWithHex:0x1B1F1A] forState:UIControlStateNormal];
|
||||
_buyButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
|
||||
[_buyButton setBackgroundImage:[UIImage imageNamed:@"recharge_now_icon"] forState:UIControlStateNormal];
|
||||
[_buyButton addTarget:self action:@selector(onTapBuyAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _buyButton;
|
||||
|
||||
Reference in New Issue
Block a user