Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
843 views
in Technique[技术] by (71.8m points)

objective c - how to resignFirstResponder from view controller

How to resignFirstResponder from uiviewcontroller object with is active.

I have five textfields one,two,three,four,five.

   - (void)removeKeyBoard{
     [one resignFirstResponder];
     [two resignFirstResponder];
     [three resignFirstResponder];
     [four resignFirstResponder];
     [five resignFirstResponder];
    }

The above code has done my job, but each object reference to specify for resignFirstResponder.

Is there any way, that handle the resignFirstResponser which ever field is active on UIViewController automatically resign that object.

@All Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Called on whatever view has the textfields in it:

[view endEditing:YES]

UIView reference: Link


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...