This commit is contained in:
2025-12-17 17:01:49 +08:00
parent dde8716262
commit 1e04e7c39a
21 changed files with 180 additions and 18 deletions

View File

@@ -17,7 +17,7 @@ static NSString * const kKBKeyboardSubscriptionCellId = @"kKBKeyboardSubscriptio
@end
@interface KBKeyboardSubscriptionView () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property (nonatomic, strong) UIView *cardView;
@property (nonatomic, strong) UIImageView *cardView;
@property (nonatomic, strong) UIButton *closeButton;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIScrollView *featureScrollView;
@@ -35,7 +35,6 @@ static NSString * const kKBKeyboardSubscriptionCellId = @"kKBKeyboardSubscriptio
@property (nonatomic, assign, getter=isLoading) BOOL loading;
@property (nonatomic, strong) CADisplayLink *featureDisplayLink;
@property (nonatomic, assign) CGFloat featureLoopWidth;
@property (nonatomic, strong) CAGradientLayer *cardGradientLayer;
@end
@implementation KBKeyboardSubscriptionView
@@ -56,7 +55,6 @@ static NSString * const kKBKeyboardSubscriptionCellId = @"kKBKeyboardSubscriptio
- (void)layoutSubviews {
[super layoutSubviews];
self.cardGradientLayer.frame = self.cardView.bounds;
self.featureLoopWidth = self.featureScrollView.contentSize.width * 0.5f;
[self startFeatureTickerIfNeeded];
}
@@ -98,10 +96,10 @@ static NSString * const kKBKeyboardSubscriptionCellId = @"kKBKeyboardSubscriptio
- (void)setupCardView {
[self addSubview:self.cardView];
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_left).offset(6);
make.right.equalTo(self.mas_right).offset(-6);
make.top.equalTo(self.mas_top).offset(4);
make.bottom.equalTo(self.mas_bottom).offset(-4);
make.left.equalTo(self.mas_left).offset(0);
make.right.equalTo(self.mas_right).offset(0);
make.top.equalTo(self.mas_top).offset(0);
make.bottom.equalTo(self.mas_bottom).offset(0);
}];
[self.cardView addSubview:self.closeButton];
@@ -422,17 +420,13 @@ static NSString * const kKBKeyboardSubscriptionCellId = @"kKBKeyboardSubscriptio
#pragma mark - Lazy
- (UIView *)cardView {
- (UIImageView *)cardView {
if (!_cardView) {
_cardView = [[UIView alloc] init];
_cardView.layer.cornerRadius = 20;
_cardView.layer.masksToBounds = YES;
_cardGradientLayer = [CAGradientLayer layer];
_cardGradientLayer.colors = @[ (id)[UIColor colorWithRed:0.80 green:0.96 blue:0.91 alpha:1].CGColor,
(id)[UIColor colorWithRed:0.72 green:0.89 blue:0.98 alpha:1].CGColor ];
_cardGradientLayer.startPoint = CGPointMake(0, 0);
_cardGradientLayer.endPoint = CGPointMake(1, 1);
[_cardView.layer insertSublayer:_cardGradientLayer atIndex:0];
_cardView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"keybord_bg_icon"]];
// _cardView.layer.cornerRadius = 20;
// _cardView.layer.masksToBounds = YES;
_cardView.contentMode = UIViewContentModeScaleAspectFill;
_cardView.clipsToBounds = true;
}
return _cardView;
}