This commit is contained in:
2025-12-16 21:43:00 +08:00
parent b43567748c
commit 5bd20a911f
4 changed files with 28 additions and 8 deletions

View File

@@ -346,10 +346,28 @@ static inline NSString *KBTrimRight(NSString *s) {
if (ivc) {
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
if ([proxy conformsToProtocol:@protocol(UITextDocumentProxy)]) {
NSString *context = proxy.documentContextBeforeInput ?: @"";
for (NSUInteger i = 0; i < context.length; i++) {
//
BOOL canAdjustCaret = [proxy respondsToSelector:@selector(adjustTextPositionByCharacterOffset:)];
if (canAdjustCaret) {
NSString *contextAfter = proxy.documentContextAfterInput ?: @"";
while (contextAfter.length > 0) {
NSInteger offset = (NSInteger)contextAfter.length;
[proxy adjustTextPositionByCharacterOffset:offset];
for (NSUInteger i = 0; i < contextAfter.length; i++) {
[proxy deleteBackward];
}
contextAfter = proxy.documentContextAfterInput ?: @"";
}
}
NSString *contextBefore = proxy.documentContextBeforeInput ?: @"";
while (contextBefore.length > 0) {
for (NSUInteger i = 0; i < contextBefore.length; i++) {
[proxy deleteBackward];
}
contextBefore = proxy.documentContextBeforeInput ?: @"";
}
if (rawText.length > 0) {
[proxy insertText:rawText];
}

View File

@@ -14,8 +14,8 @@
@implementation KBGuideKFCell
- (void)setupUI {
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.avatarImageView];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16);

View File

@@ -16,7 +16,9 @@
@implementation KBGuideUserCell
- (void)setupUI {
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.avatarImageView];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {

View File

@@ -35,8 +35,8 @@
[self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.bgView);
make.right.equalTo(self.bgView).offset(-8);
make.width.mas_greaterThanOrEqualTo(84);
make.right.equalTo(self.bgView).offset(-4);
make.width.mas_equalTo(84);
make.height.mas_equalTo(32);
}];