ios - UITextView selectAll method not working as expected -
I am making iOS 8 App with Xcode 6.0.1 for my iPhone 5 (which is iOS 8.0.2 ). I want to make it so much that when a user clicks on my When this method is called, then I expect the console output (i.e. I have seen many questions like this on the Internet, but did not work for me for any solution (and some of them did not work for a bug without providing any solution In the form it is written) To do something other than to change this ID "itemprop =" text "> This solution also works and does not require subclassification Objective 3 - Swift 3 - UITextView , all the text is selected so that they start typing and erase it easily (but I do not want to Text is automatically erased because users want to keep it or attach it) To do this, I have the following code:
- (zero) textViewDidBeginEditing: (UITextView *) TextView {if ([TextView hasText]) {NSLog (@ "before selectedRange:% d ", TextView.selectedRange.length); [Select TextViewAll: Self]; NSLog (@ selected range after:% d ", textView.selectedRange.length); }}
selectedRange length is similar to the number of characters in the code> text view < / Code> text). However, nothing appears as selected in
UITextView and it is not selected (i.e. no selection menu pops up).
self (like
zero ) did not help, and neither calling it to
[Selection TextView: Self] As a person suggested I also tried this code:
- (zero) textViewDidBeginEditing: (UITextView *) TextView {if ([ TextView hasText]) {UITextRange * border = [TextView textRangeFromPosition: textView.beginningOfDocument toPosition: textView.endOfDocument]; [TextView set selected selected selected text: Category];
UITextView , just on your representative Enter this function:
- (bool) textViewShouldBeginEditing: (UITextView *) TextView {dispatch_async (dispatch_get_main_queue (), ^ {[TextView selectAll: Zero] ;} Return;}
function textViewDidBeginEditing (_VideoView) (Zero)}}
Comments
Post a Comment