开发者

after inputAccessoryView tapped

I have tried the solutions at UITextView doesn't show InputAccessoryView on fir开发者_运维技巧st click

I'm having a with a problem with a textView who has a inputAccessoryView

I want to call [textView resignFirstResponder] through its inputAccessoryView,so that i can close the keyboard

and there is only a UIButton on the inputAccessoryView,and the tapping the button will invoke an IBAction method call -(IBAction)closeKeyboard:(id)sender;

now the sender in the method is the button on the inputAccessoryView,

question is ,

how can i find out this textView whose inputAccessoryView has been tapped,

or just get a pointed which is pointed to this textView,so i can call

[textView resignFirstResponder]??


You need to find the current first responder. If you have outlets to all your text views, you can ask each one in turn

if ([textView1 isFirstResponder])
    [textView resignFirstResponder];

Though this may give you problems depending on your button (see here, but I haven't experienced this), if so use the editing property of the text view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜