【发布时间】:2013-09-20 20:58:02
【问题描述】:
我正在尝试确定UITextView 中的哪个特定字符已被窃听。我尝试使用characterRangeAtPoint: 方法。但它总是返回零,无论我在UITextView 中点击什么。
我什至编写并运行了以下代码:
for (int x = 0; x<1000; x++) {
pos.x = x;
for (int y = 0; y<1000; y++) {
pos.y = y;
UITextRange * range = [textView characterRangeAtPoint:pos];
if (range!=nil) {
NSLog(@"x: %f, y: %f", pos.x, pos.y);
}
}
}
好吧,它永远不会到达NSLog 字符串。
我做错了什么?
【问题讨论】:
标签: iphone ios objective-c uikit core-text