Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有几个分号分隔的字符串的 NSTextView。我需要找到插入符号放置在哪些字符串上。我怎么能那样做?
NSInteger insertionPoint = [[[myTextView selectedRanges] objectAtIndex:0] rangeValue].location;
对于斯威夫特 4
let insertionPointIndex = myTextView.selectedRanges.first?.rangeValue.location