I'm having trouble getting my UITextView to become editable when it is touched.
I've included the following code per the Apple documentation.
-(BOOL)textViewShouldBeginEditing:(UITextView *)textView{
NSLog(@"begin editing");
return YES;
}
-(BOOL)textViewShouldEndEditing:(UITextView *)textView{
NSLog(@"end editing");
return NO;
}
I"ve also read through the apple documentation and have made the textview the delegate, but it still doesn't seem to be working. I'm pretty much trying to go with the notepad affect where once you are finished editing, numbers and such are hyperlinked.
In order to have that notepad effect, where numbers and links are hyperlinked, you would need to replace your UITextView
with a special CoreTextView
. I'd modify something like this to your needs: https://github.com/jasarien/CoreTextHyperlinkView . So in textViewShouldEndEditing:
you would populate your CoreTextHyperlinkView text with textView.text
, hide the textView and show your CoreTextView. And vice versa in textViewShouldBeginEditing:
.
Also, make sure you reference the <UITextViewDelegate>
protocol in your header.
Remember to set your textView's delegate, otherwise those methods won't get called
self.textView.delegate = self; // assuming self is the view controller with your textView
And remember <UITextViewDelegate>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.