Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html#//apple_ref/occ/intf/UITextViewDelegate" rel="noreferrer">http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html#//apple_ref/occ/intf/UITextViewDelegate</a></p> <p>Here you can find several useful methods to investigate:</p> <ul> <li><code>textViewDidBeginEditing:</code></li> <li><code>textViewDidEndEditing:</code></li> </ul> <p>Moreover to live <code>UITextView</code> you often should implement action that calls <code>[yourTextView resignFirstResponder];</code></p> <p><strong>UPD: brief example</strong></p> <pre><code>//you may specify UITextViewDelegate protocol in .h file interface, but it's better not to expose it if not necessary @interface ExampleViewController()&lt;UITextViewDelegate&gt; @end @implementation ExampleViewController - (void)viewDidLoad { [super viewDidLoad]; //assuming _textView is already instantiated and added to its superview _textView.delegate = self; } //it's nice to separate delegate methods with pragmas but it's up to your local code style policy #pragma mark UITextViewDelegate - (void)textViewDidBeginEditing:(UITextView *)textView { //handle user taps text view to type text } - (void)textViewDidEndEditing:(UITextView *)textView { //handle text editing finished } @end </code></pre> <p><strong>Swift Example</strong></p> <pre><code>class TextViewEventsViewController: UIViewController, UITextViewDelegate { @IBOutlet weak var exampleTextView: UITextView! override func viewDidLoad() { super.viewDidLoad() self.exampleTextView.delegate = self } func textViewDidBeginEditing(_ textView: UITextView) { print("exampleTextView: BEGIN EDIT") } func textViewDidEndEditing(_ textView: UITextView) { print("exampleTextView: END EDIT") } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload