Files
keyboard/CustomKeyboard/View/KBFunctionPasteView.m

89 lines
2.9 KiB
Mathematica
Raw Normal View History

2025-10-28 14:30:03 +08:00
//
// KBFunctionPasteView.m
// CustomKeyboard
//
// Created by Mac on 2025/10/28.
// View
#import "KBFunctionPasteView.h"
#import "Masonry.h"
2025-11-26 21:16:56 +08:00
#import "KBFont.h"
2025-10-28 14:30:03 +08:00
@interface KBFunctionPasteView ()
@property (nonatomic, strong) UIImageView *iconViewInternal;
@property (nonatomic, strong) UILabel *placeholderLabelInternal;
2025-11-26 21:16:56 +08:00
@property (nonatomic, strong) UIButton *pasBtn;
2025-10-28 14:30:03 +08:00
@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;
2025-11-26 21:16:56 +08:00
// [self addSubview:self.iconViewInternal];
// [self addSubview:self.placeholderLabelInternal];
[self addSubview:self.pasBtn];
[self.pasBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
2025-10-28 14:30:03 +08:00
}];
2025-11-26 21:16:56 +08:00
// [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);
// }];
2025-10-28 14:30:03 +08:00
}
return self;
}
#pragma mark - Lazy
- (UIImageView *)iconViewInternal {
if (!_iconViewInternal) {
_iconViewInternal = [[UIImageView alloc] init];
2025-11-26 21:16:56 +08:00
_iconViewInternal.image = [UIImage imageNamed:@"kb_zt_icon"];
2025-10-28 14:30:03 +08:00
}
return _iconViewInternal;
}
- (UILabel *)placeholderLabelInternal {
if (!_placeholderLabelInternal) {
_placeholderLabelInternal = [[UILabel alloc] init];
2025-11-26 21:16:56 +08:00
// 稿
_placeholderLabelInternal.text = KBLocalized(@"Paste Ta's Words");
2025-10-28 14:30:03 +08:00
_placeholderLabelInternal.textColor = [UIColor colorWithRed:0.20 green:0.64 blue:0.54 alpha:1.0];
_placeholderLabelInternal.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
}
return _placeholderLabelInternal;
}
2025-11-26 21:16:56 +08:00
- (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;
}
2025-10-28 14:30:03 +08:00
#pragma mark - Expose
- (UIImageView *)iconView { return self.iconViewInternal; }
- (UILabel *)placeholderLabel { return self.placeholderLabelInternal; }
@end