I was trying to follow this post to get pixel position of a certain word in my UITextView, but the following code:
UITextPosition *beginning = cell.textView.beginningOfDocument;
caused my App to crash (seems to be in iOS4 only, but according to documentations UITextInput beginningOfDocument
should be available since iOS3.2). I tried to debug the issue and get the following output:
(gdb) po cell
<ReadTableViewCell: 0x1bf25d60; baseClass = UITableViewCell; frame = (0 0; 320 44); userInteractionEnabled = NO; tag = 1248776; layer = <CALayer: 0x1bf25d20>>
(gdb) po [cell textView]
<UITextView: 0x1bf26810; frame = (5 4; 309 121); text = 'Subject Header
Detailed Content...'; clipsToBounds = YES; layer = <CALayer: 0x1bf26650>; contentOffset: {0, 0}>
(gdb) po [[cell textView] beginningOfDocument]
Target does not respond to this message selector.
(gdb)
Could somebody please kindly give me some hint as how to fix or avoid this? Thanks in advance!!