2
This commit is contained in:
18
keyBoard/Class/Search/V/KBHistoryMoreCell.h
Normal file
18
keyBoard/Class/Search/V/KBHistoryMoreCell.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// KBHistoryMoreCell.h
|
||||
// keyBoard
|
||||
//
|
||||
// 历史记录第二行尾部的“展开更多”按钮 cell(向下箭头)。
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBHistoryMoreCell : UICollectionViewCell
|
||||
/// 固定尺寸建议(高度与标签一致 32)
|
||||
+ (CGSize)fixedSize;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
56
keyBoard/Class/Search/V/KBHistoryMoreCell.m
Normal file
56
keyBoard/Class/Search/V/KBHistoryMoreCell.m
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// KBHistoryMoreCell.m
|
||||
// keyBoard
|
||||
//
|
||||
|
||||
#import "KBHistoryMoreCell.h"
|
||||
|
||||
@interface KBHistoryMoreCell ()
|
||||
@property (nonatomic, strong) UIView *bgView;
|
||||
@property (nonatomic, strong) UIImageView *iconView;
|
||||
@end
|
||||
|
||||
@implementation KBHistoryMoreCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:self.bgView];
|
||||
[self.bgView addSubview:self.iconView];
|
||||
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self.bgView);
|
||||
make.width.height.mas_equalTo(14);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (CGSize)fixedSize { return CGSizeMake(32, 32); }
|
||||
|
||||
#pragma mark - Lazy
|
||||
|
||||
- (UIView *)bgView {
|
||||
if (!_bgView) {
|
||||
_bgView = [[UIView alloc] init];
|
||||
_bgView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
|
||||
_bgView.layer.cornerRadius = 16;
|
||||
_bgView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconView {
|
||||
if (!_iconView) {
|
||||
_iconView = [[UIImageView alloc] initWithImage:[UIImage systemImageNamed:@"chevron.down"]];
|
||||
_iconView.tintColor = [UIColor colorWithHex:0x9A9A9A];
|
||||
_iconView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _iconView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user