测试假数据

This commit is contained in:
2025-11-11 21:48:26 +08:00
parent 1d064c1f31
commit f387b95d0d
2 changed files with 76 additions and 3 deletions

View File

@@ -8,6 +8,7 @@
//
#import "KBStreamTextView.h"
#import "KBResponderUtils.h" // UIInputViewController宿
@interface KBStreamTextView ()
@@ -170,7 +171,7 @@
label.textColor = self.labelTextColor;
label.userInteractionEnabled = YES;
label.text = @"";
label.backgroundColor = [UIColor redColor];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleLabelTap:)];
[label addGestureRecognizer:tap];
@@ -256,8 +257,19 @@
UILabel *label = (UILabel *)tap.view;
if (![label isKindOfClass:[UILabel class]]) { return; }
NSInteger index = [self.labels indexOfObject:label];
NSString *text = label.text ?: @"";
if (index != NSNotFound && self.onLabelTap) {
self.onLabelTap(index, label.text ?: @"");
self.onLabelTap(index, text);
}
// 宿/TextView
// 访 insertText:
UIInputViewController *ivc = KBFindInputViewController(self);
if (ivc) {
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
if (text.length > 0 && [proxy conformsToProtocol:@protocol(UITextDocumentProxy)]) {
[proxy insertText:text];
}
}
}