0

I'm building an .api file for iOS app that is made with Xcode 7.2, i have two fields in my page - email and phone. When i try to edit the email or phone in textfield the keyboard appears.

Handle to hide keyboard in

  1. keyboard Done button
  2. Update button
  3. Textfield added over the UIControl, handle on TouchDown Event.

with code [self.view endEditing:TRUE]; but can't able to hide the keyboard.

Issue Occurs only when build .api file and launch.. if i debug the same version of code, its works fine - keyboard hidden when click done or when click over the view..

Any help is welcome..

Thanks!

Keyboard not closed when click Done or when click update button

PrasathBabu
  • 4,716
  • 4
  • 19
  • 35
  • make sure delegates are attached to those textfields... – Fahim Parkar Jan 20 '16 at 11:42
  • 2
    1) CODELESS, Zero Line Of Code. 2) Works Automatically 3) No More UIScrollView 4) No More Subclasses 5) No More Manual Work 6) No More #imports http://www.codeproject.com/Tips/846002/Codeless-IQKeyboardManager-for-iOS – iOS Developer Jan 20 '16 at 11:43
  • yes.. delegates added for the textfields.. Its works when i debug from xcode but when i build .ipa the issue occurs.. @Fahim Parkar – PrasathBabu Jan 20 '16 at 11:46
  • Thanks for sample,its good.. but its not resolve my issue.. @iOSDeveloper – PrasathBabu Jan 20 '16 at 12:26
  • does the ipa works on iphone without an issue ? @Prasath – Teja Nandamuri Jan 20 '16 at 14:43
  • @Mr.T yes.. its working good, only this keyboard issue – PrasathBabu Jan 21 '16 at 01:52
  • Keyboard issue - because of UIControl in ViewController.. Whole UI added under UIControl and Email,Phone Textfield added under scrollview(TPKeyboardAvoidingScrollView), in UIControl OnTouchdown action keyboard hidden handled.. now removed the UIControl outlet,actions and class in UI.. keyboard hidden handled with Touch Gestures.. now keyboard hidden in all cases.. its working fine, when build ipa or when we debug.. The issue resolved.. Thanks all for ur support... – PrasathBabu Jan 21 '16 at 10:23

3 Answers3

0

Implement the delegate method

- (void)viewDidLoad 
{
[super viewDidLoad];
self.yourIBtextField.delegate = self;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{
[textField resignFirstResponder];
return NO;
}
Tejas Patel
  • 850
  • 10
  • 26
0

Keyboard issue - because of UIControl in ViewController..

Whole UI added under UIControl and Email,Phone Textfield added under scrollview(TPKeyboardAvoidingScrollView), in UIControl OnTouchdown action keyboard hidden handled..

now removed the UIControl outlet,actions and class in UI.. keyboard hidden handled with Touch Gestures..

now keyboard hidden in all cases.. its working fine, when build ipa or when debug..

The issue resolved..

PrasathBabu
  • 4,716
  • 4
  • 19
  • 35
0
  1. For keyboard done button: Implement the delegate method

    - (void) textFieldShouldReturn:(UITextField)textField
    {
        [self.emailTF resignFirstResponder];
        [self.phoneTF resignFirstResponder];
    
    }
    
  2. For update Button: Implement the method

    - (void)updateButtonClick:(UIButton *)button
    {
    
       /the code you want to write.../
    
       [self.emailTF resignFirstResponder];
       [self.phoneTF resignFirstResponder];
    
    }
    
  3. For touch self.view to return keyBoard: Implement the method

    - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
    {
    
       [self.emailTF resignFirstResponder];
       [self.phoneTF resignFirstResponder];  
    
    }
    

Hope that this answer can help you :)