hackiftekhar / IQKeyboardManager

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.
MIT License
16.43k stars 2.4k forks source link

version 5.0.8: unable to disable IQKeyboard #1269

Closed ajf-sp closed 6 years ago

ajf-sp commented 6 years ago

Tried the following:

in my StakesViewController:

IQKeyboardManager.sharedManager().enable = false
IQKeyboardManager.sharedManager().enableAutoToolbar = false

in my AppDelegate:

IQKeyboardManager.sharedManager().disabledDistanceHandlingClasses.append(StakesViewController.self)
IQKeyboardManager.sharedManager().disabledToolbarClasses.append(StakesViewController.self)

Either implementation doesn't work. I even tried implementing both to no avail.

meet2011 commented 6 years ago

@hackiftekhar I'm also having similar issue. When I use two actions(Next and Done) on my numberpad textfield, I see one action(Next) so I decided to disable IQKeyboardManager but it doesn't work with the following code.

IQKeyboardManager.sharedManager().enable = false

I tried above code in AppDelegate

UIToolbar *toolBarView = [[UIToolbar alloc] init];
[toolBarView sizeToFit];

UIBarButtonItem *flexibleSpaceBtn = [[UIBarButtonItem alloc]
                                         initWithBarButtonSystemItem:
                                         UIBarButtonSystemItemFlexibleSpace
                                         target:self
                                         action:nil];

 UIBarButtonItem *nextBtn = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(nextClicked:)];

 UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(doneClicked:)];

 toolBarView.tintColor = [UIColor blackColor];
 toolBarView.items = @[doneBtn,flexibleSpaceBtn,nextBtn];

 self.dobTF.inputAccessoryView = toolBarView;

is this because of the library its not working?

hackiftekhar commented 6 years ago

I'm not sure @ajf-sp @meet2011 but this should work. If not then can you please share a demo with me?

ajf-sp commented 6 years ago

Hi @hackiftekhar thanks for responding. This is related to the other issue I reported. IQKeyboard is unable to find next/previous fields even if I try to add manually. Instead of proceeding to next/previous, the keyboard is dismissed.

So now I try to manually handle my keyboard by disabling IQKeyboardManager and assigning my own UIToolbar. But it still interferes with my view, calling textFieldShouldBeginEditing twice, and dismissing the keyboard when i call becomeFirstResponder on the next textfield.

I have disabled IQKeyboard in the past version (I was using 4.0.3 i think) but now, it doesn't work.

hackiftekhar commented 6 years ago

Can you please share a demo project demonstrating you disabled library and it doesn't work. Could you please confirm it's not the same issue as other issue you are referencing?

meet2011 commented 6 years ago

@hackiftekhar are we doing it correctly to disable library?

IQKeyboardManager.sharedManager().enable = false

hackiftekhar commented 6 years ago

Yes, you are doing correct. But this only disable managing distance between textField and keyboard. If you want to disable toolbar then there is another property to do that.

ajf-sp commented 6 years ago

It turns out that the issue was something else entirely. Calling tableView's reloadData automatically resigns first responder, and that's what's interfering with the implementation. Sorry for the trouble!

@meet2011 hope this points you to the right direction

meet2011 commented 6 years ago

How to disable/enable toolbar for particular controller.

meet2011 commented 6 years ago

I want to disable so that I can use my code for tool bar as your code is not working perfectly for me.

hackiftekhar commented 6 years ago

@meet2011 enableAutoToolbar = NO