resignFirstResponder for all textfields

IphoneObjective CUitextfield

Iphone Problem Overview


I'm working on an iphone app with multiple textfields on a viewcontroller. I'm a bit confused with resignfirstresponder and setting textfield delegates.I've been able to resign text fields when I set the delegate for one then call resignfirstresponder for that particular textfield. I have a view controller with about 7 text fields and don't want to call each individually. Does anyone have any example code that will close all of the textfields on a view controller? Also how do you set the delegate for all textfields?

Thanks!

Iphone Solutions


Solution 1 - Iphone

try using this

[self.view endEditing:YES];

This will hide keyboard if its presented due to a subview of your self.view

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrea FView Question on Stackoverflow
Solution 1 - IphoneHarshITView Answer on Stackoverflow