// // KBFunctionPasteView.m // CustomKeyboard // // Created by Mac on 2025/10/28. // 粘贴View #import "KBFunctionPasteView.h" #import "Masonry.h" #import "KBFont.h" @interface KBFunctionPasteView () @property (nonatomic, strong) UIImageView *iconViewInternal; @property (nonatomic, strong) UILabel *placeholderLabelInternal; @property (nonatomic, strong) UIButton *pasBtn; @end @implementation KBFunctionPasteView - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // 白底圆角容器 self.backgroundColor = [UIColor colorWithWhite:1 alpha:0.95]; self.layer.cornerRadius = 12.0; self.layer.masksToBounds = YES; // [self addSubview:self.iconViewInternal]; // [self addSubview:self.placeholderLabelInternal]; [self addSubview:self.pasBtn]; [self.pasBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self); }]; // [self.iconViewInternal mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(self.mas_left).offset(12); // make.centerY.equalTo(self.mas_centerY); // make.width.height.mas_equalTo(20); // }]; // [self.placeholderLabelInternal mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(self.iconViewInternal.mas_right).offset(8); // make.right.equalTo(self.mas_right).offset(-12); // make.centerY.equalTo(self.mas_centerY); // }]; } return self; } #pragma mark - Lazy - (UIImageView *)iconViewInternal { if (!_iconViewInternal) { _iconViewInternal = [[UIImageView alloc] init]; _iconViewInternal.image = [UIImage imageNamed:@"kb_zt_icon"]; } return _iconViewInternal; } - (UILabel *)placeholderLabelInternal { if (!_placeholderLabelInternal) { _placeholderLabelInternal = [[UILabel alloc] init]; // 文案改为更贴近设计稿 _placeholderLabelInternal.text = KBLocalized(@"Paste Ta's Words"); _placeholderLabelInternal.textColor = [UIColor colorWithRed:0.20 green:0.64 blue:0.54 alpha:1.0]; _placeholderLabelInternal.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; } return _placeholderLabelInternal; } - (UIButton *)pasBtn{ if (!_pasBtn) { _pasBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_pasBtn setImage:[UIImage imageNamed:@"kb_zt_icon"] forState:UIControlStateNormal]; [_pasBtn setTitle:KBLocalized(@" Paste Ta's Words") forState:UIControlStateNormal]; [_pasBtn setTitleColor:[UIColor colorWithHex:0x02BEAC] forState:UIControlStateNormal]; _pasBtn.titleLabel.font = [KBFont medium:13]; _pasBtn.backgroundColor = [UIColor whiteColor]; } return _pasBtn; } #pragma mark - Expose - (UIImageView *)iconView { return self.iconViewInternal; } - (UILabel *)placeholderLabel { return self.placeholderLabelInternal; } @end