Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift - How to disable IQKeyboardManager in a specific UIViewController #252

Closed
diegothucao opened this issue Jul 29, 2015 · 21 comments
Closed
Labels

Comments

@diegothucao
Copy link

Dear fiiends,
I am using IQKeyboardManager for my Swift Project (iOS 8.4).
Now I want IQKeyboardManager does not affect a specific UIViewController in my projects. How to make it ?

Thanks in advance,

Thu

@hackiftekhar
Copy link
Owner

Use 'disableInViewControllerClass' method to disable it for a viewController.

@diegothucao
Copy link
Author

It seems does not work

@diegothucao
Copy link
Author

In Swift, there is no method to get Class, Am I right ?

@hackiftekhar
Copy link
Owner

You should pass class name directly. For example your class name is 'Person' then you should pass 'Person' in the method.

@raj-engineer
Copy link

there is no such method like 'disableInViewControllerClass'

@nitrodamsel
Copy link

IQKeyboardManager.sharedManager().disabledToolbarClasses = [QuantityPickerDialog.self] //of type UIViewController

@hackiftekhar
Copy link
Owner

Thanks @rjcristy. @raj-android-iOS, they are replaced by properties so now you have to use them like mentioned by @rjcristy.

@haydenholligan
Copy link

I believe you have to do IQKeyboardManager.shared().disabledToolbarClasses.add(YourViewController.self), as disabledToolbarClasses is read-only.

@bibekdari
Copy link

disabledDistanceHandlingClasses
disabledDistanceHandlingClasses
disabledToolbarClasses
disabledTouchResignedClasses

@paresh-navadiya
Copy link

paresh-navadiya commented Feb 2, 2018

Need to use disabledDistanceHandlingClasses. For example

IQKeyboardManager.sharedManager().disabledDistanceHandlingClasses.append(YourViewController.self)

@Henry-
Copy link

Henry- commented Sep 11, 2018

Swift 4:
IQKeyboardManager.shared.disabledDistanceHandlingClasses.append(YourViewController.self)

@cmdr-surender-singh
Copy link

IQKeyboardManager.sharedManager().disabledToolbarClasses = [QuantityPickerDialog.self] //of type UIViewController

@rjcristy thank you sooo much ....
actually i am working in chat controller using jsqmessageviewcontroller, and stuck to found the issue of status bar which is transparent when keyboard mic tap

thank you so much.

@JoakimLiu
Copy link

IQKeyboardManager.shared().isEnabled = false
IQKeyboardManager.shared().isEnableAutoToolbar = false

@yudhishtadhayalan
Copy link

IQKeyboardManager.shared().isEnabled = false
IQKeyboardManager.shared().isEnableAutoToolbar = false

Thanks Bro...

@w-i-n-s
Copy link

w-i-n-s commented Jun 23, 2019

Nothing works =(
what I did try:

  • disabledToolbarClasses etc.
  • willAppear -> enable=false, willDissapear -> enable = true.
    • With or without toolbar

@AdamNasser2
Copy link

AdamNasser2 commented Aug 30, 2019

For Swift 4 and IQKeyboardManager Version 5.00:
App Delegate.swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
      IQKeyboardManager.shared().isEnabled = false
      IQKeyboardManager.shared().disabledToolbarClasses.add(CreateController.self)
     IQKeyboardManager.shared().enabledDistanceHandlingClasses.add(SignUpFormController.self
 }

@srikanthkumarmailid07
Copy link

Write this code in a particular controller inside of view did load method

 IQKeyboardManager.shared.disabledToolbarClasses = [ForgotConfirmationvc.self]
 IQKeyboardManager.shared.enable = false
override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(true)
    IQKeyboardManager.shared.enable = true
}

@netgfx
Copy link

netgfx commented Apr 6, 2020

nothing works... the input keeps scrolling up, even though there is enough space for the keyboard, and I have placed everything mentioned here to disable it.

@maxim-sargarovschi
Copy link

I added in my VC didLoad method
IQKeyboardManager.shared.enable = false
and in willDesappear
IQKeyboardManager.shared.enable = false
and in appDelegate
IQKeyboardManager.shared.disabledDistanceHandlingClasses = [myVC.self]

and in this vc the view still scroll up when keyboard is showing ...

@Adakhan
Copy link

Adakhan commented Feb 27, 2021

    IQKeyboardManager.shared.disabledTouchResignedClasses = [YourViewController.self]

@realxnesia
Copy link

`
in your AppDelegate.swift

  Import IQKeyboardManager 
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
          // Override point for customization after application launch.
          IQKeyboardManager.shared().isEnabled = true
          return true
  }

Then setup like this in your TargetViewController.swift

    Import IQKeyboardManager 
    override func viewDidLoad() {
                  IQKeyboardManager.shared().isEnabled = false
                  IQKeyboardManager.shared().isEnableAutoToolbar = false
    }
    override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)
            IQKeyboardManager.shared().isEnabled = true
            IQKeyboardManager.shared().isEnableAutoToolbar = true
    }

Build and Run!!

Already tested in 2022

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests