diff --git a/CustomKeyboard/View/KBFunctionView.m b/CustomKeyboard/View/KBFunctionView.m index 533d167..4bee11f 100644 --- a/CustomKeyboard/View/KBFunctionView.m +++ b/CustomKeyboard/View/KBFunctionView.m @@ -136,19 +136,24 @@ - (void)setupUI { // 1. 顶部 Bar [self addSubview:self.barViewInternal]; + CGFloat barTopInset = KBFit(6.0f); + CGFloat barHeight = KBFit(52.0f); [self.barViewInternal mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self); - make.top.equalTo(self.mas_top).offset(6); - make.height.mas_equalTo(52); + make.top.equalTo(self.mas_top).offset(barTopInset); + make.height.mas_equalTo(barHeight); }]; // 右侧竖排按钮容器 [self addSubview:self.rightButtonContainer]; + CGFloat rightInset = KBFit(4.0f); + CGFloat containerBottomInset = KBFit(10.0f); + CGFloat containerWidth = KBFit(60.0f); [self.rightButtonContainer mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.mas_right).offset(-4); + make.right.equalTo(self.mas_right).offset(-rightInset); make.top.equalTo(self.barViewInternal.mas_bottom).offset(0); - make.bottom.equalTo(self.mas_bottom).offset(-10); - make.width.mas_equalTo(60); + make.bottom.equalTo(self.mas_bottom).offset(0); + make.width.mas_equalTo(containerWidth); }]; // 右侧四个按钮 @@ -158,10 +163,10 @@ [self.rightButtonContainer addSubview:self.sendButtonInternal]; // 竖向排布:粘贴、删除、清空为等高;发送优先更高,但允许在空间不足时压缩 - CGFloat smallH = 41; - CGFloat bigH = 56; - // 原 10 在键盘总高度 276 下容易超出容器,改为 8 以避免 AutoLayout 冲突 - CGFloat vSpace = 4; + CGFloat smallH = KBFit(41.0f); + CGFloat bigH = KBFit(56.0f); + // 竖向/横向间距按设计稿等比缩放,避免大屏出现过大空隙 + CGFloat vSpace = KBFit(4.0f); [self.pasteButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.rightButtonContainer.mas_top); make.left.right.equalTo(self.rightButtonContainer); @@ -202,8 +207,8 @@ [self.tagListView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.pasteViewInternal); make.right.equalTo(self.rightButtonContainer.mas_left).offset(-vSpace); - make.top.equalTo(self.pasteViewInternal.mas_bottom).offset(vSpace); - make.bottom.equalTo(self.mas_bottom).offset(-10); + make.top.equalTo(self.pasteViewInternal.mas_bottom).offset(0); + make.bottom.equalTo(self.mas_bottom).offset(0); }]; } @@ -238,11 +243,13 @@ [self addSubview:overlay]; [overlay mas_makeConstraints:^(MASConstraintMaker *make) { // 在原标签区域内展示流式文本,右侧继续保留竖排按钮栏 - CGFloat vSpace = 4.0; + CGFloat vSpace = KBFit(4.0f); + CGFloat overlayTopInset = KBFit(10.0f); + CGFloat overlayBottomInset = KBFit(10.0f); make.left.equalTo(self.pasteViewInternal); make.right.equalTo(self).offset(-vSpace); - make.top.equalTo(self.pasteViewInternal.mas_bottom).offset(10); - make.bottom.equalTo(self.mas_bottom).offset(-10); + make.top.equalTo(self.pasteViewInternal.mas_bottom).offset(overlayTopInset); + make.bottom.equalTo(self.mas_bottom).offset(-overlayBottomInset); }]; // 仅隐藏删除/清空/发送按钮,保留“Paste”按钮可用 self.pasteButtonInternal.hidden = NO;