UITextView resign first responder on 'Done'

前端 未结 2 1770
鱼传尺愫
鱼传尺愫 2021-02-05 17:45

I have been searching around the web for about an hour now, and cannot find any code to help me with this.

I have a UITextView that I need to resign first r

2条回答
  •  梦谈多话
    2021-02-05 18:09

    You can use the delegate method

    - (void)textViewDidEndEditing:(UITextView *)textView { 
        [textView resignFirstResponder];
    }
    

    You have to set your controller as the delegate for the TextView. For more methods you can have a look here: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html%23//apple_ref/doc/uid/TP40006897

提交回复
热议问题