How to hide Toolbar in IQKeyboardManager iOS Swift 3












4















I'm using the IQKeyboardManger library to scroll text fields when started typing using the keyboard, but I don't want to display the default toolbar from their library. Below is the code I've used.



override func viewDidLoad() {
super.viewDidLoad()

self.chatTextField.inputAccessoryView = [[UIView alloc] init]; //This will remove toolbar which have done button.

self.chatTextField.keyboardDistanceFromTextField = 8; //This will modify default distance between textField and keyboard. For exact value, please manually check how far your textField from the bottom of the page. Mine was 8pt.

}


enter image description here










share|improve this question




















  • 1





    IQToolbar handling

    – Bhavin Ramani
    Oct 19 '16 at 7:23











  • @BhavinRamani where can I enable this value?

    – Gijo Varghese
    Oct 19 '16 at 7:27






  • 1





    in AppDelegate didFinishLaunchingWithOptions method.

    – Bhavin Ramani
    Oct 19 '16 at 7:28













  • Is your code snippet a collection of Objective-c and Swift? O.o

    – Ahmad F
    Oct 19 '16 at 7:30











  • @AhmadF Great! That one worked. Mine is in Swift 3

    – Gijo Varghese
    Oct 19 '16 at 7:32
















4















I'm using the IQKeyboardManger library to scroll text fields when started typing using the keyboard, but I don't want to display the default toolbar from their library. Below is the code I've used.



override func viewDidLoad() {
super.viewDidLoad()

self.chatTextField.inputAccessoryView = [[UIView alloc] init]; //This will remove toolbar which have done button.

self.chatTextField.keyboardDistanceFromTextField = 8; //This will modify default distance between textField and keyboard. For exact value, please manually check how far your textField from the bottom of the page. Mine was 8pt.

}


enter image description here










share|improve this question




















  • 1





    IQToolbar handling

    – Bhavin Ramani
    Oct 19 '16 at 7:23











  • @BhavinRamani where can I enable this value?

    – Gijo Varghese
    Oct 19 '16 at 7:27






  • 1





    in AppDelegate didFinishLaunchingWithOptions method.

    – Bhavin Ramani
    Oct 19 '16 at 7:28













  • Is your code snippet a collection of Objective-c and Swift? O.o

    – Ahmad F
    Oct 19 '16 at 7:30











  • @AhmadF Great! That one worked. Mine is in Swift 3

    – Gijo Varghese
    Oct 19 '16 at 7:32














4












4








4


1






I'm using the IQKeyboardManger library to scroll text fields when started typing using the keyboard, but I don't want to display the default toolbar from their library. Below is the code I've used.



override func viewDidLoad() {
super.viewDidLoad()

self.chatTextField.inputAccessoryView = [[UIView alloc] init]; //This will remove toolbar which have done button.

self.chatTextField.keyboardDistanceFromTextField = 8; //This will modify default distance between textField and keyboard. For exact value, please manually check how far your textField from the bottom of the page. Mine was 8pt.

}


enter image description here










share|improve this question
















I'm using the IQKeyboardManger library to scroll text fields when started typing using the keyboard, but I don't want to display the default toolbar from their library. Below is the code I've used.



override func viewDidLoad() {
super.viewDidLoad()

self.chatTextField.inputAccessoryView = [[UIView alloc] init]; //This will remove toolbar which have done button.

self.chatTextField.keyboardDistanceFromTextField = 8; //This will modify default distance between textField and keyboard. For exact value, please manually check how far your textField from the bottom of the page. Mine was 8pt.

}


enter image description here







ios swift uitextfield ios-keyboard-extension iqkeyboardmanager






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 2 '17 at 15:39









Tamás Sengel

28.3k1576100




28.3k1576100










asked Oct 19 '16 at 7:02









Gijo VargheseGijo Varghese

2,873104170




2,873104170








  • 1





    IQToolbar handling

    – Bhavin Ramani
    Oct 19 '16 at 7:23











  • @BhavinRamani where can I enable this value?

    – Gijo Varghese
    Oct 19 '16 at 7:27






  • 1





    in AppDelegate didFinishLaunchingWithOptions method.

    – Bhavin Ramani
    Oct 19 '16 at 7:28













  • Is your code snippet a collection of Objective-c and Swift? O.o

    – Ahmad F
    Oct 19 '16 at 7:30











  • @AhmadF Great! That one worked. Mine is in Swift 3

    – Gijo Varghese
    Oct 19 '16 at 7:32














  • 1





    IQToolbar handling

    – Bhavin Ramani
    Oct 19 '16 at 7:23











  • @BhavinRamani where can I enable this value?

    – Gijo Varghese
    Oct 19 '16 at 7:27






  • 1





    in AppDelegate didFinishLaunchingWithOptions method.

    – Bhavin Ramani
    Oct 19 '16 at 7:28













  • Is your code snippet a collection of Objective-c and Swift? O.o

    – Ahmad F
    Oct 19 '16 at 7:30











  • @AhmadF Great! That one worked. Mine is in Swift 3

    – Gijo Varghese
    Oct 19 '16 at 7:32








1




1





IQToolbar handling

– Bhavin Ramani
Oct 19 '16 at 7:23





IQToolbar handling

– Bhavin Ramani
Oct 19 '16 at 7:23













@BhavinRamani where can I enable this value?

– Gijo Varghese
Oct 19 '16 at 7:27





@BhavinRamani where can I enable this value?

– Gijo Varghese
Oct 19 '16 at 7:27




1




1





in AppDelegate didFinishLaunchingWithOptions method.

– Bhavin Ramani
Oct 19 '16 at 7:28







in AppDelegate didFinishLaunchingWithOptions method.

– Bhavin Ramani
Oct 19 '16 at 7:28















Is your code snippet a collection of Objective-c and Swift? O.o

– Ahmad F
Oct 19 '16 at 7:30





Is your code snippet a collection of Objective-c and Swift? O.o

– Ahmad F
Oct 19 '16 at 7:30













@AhmadF Great! That one worked. Mine is in Swift 3

– Gijo Varghese
Oct 19 '16 at 7:32





@AhmadF Great! That one worked. Mine is in Swift 3

– Gijo Varghese
Oct 19 '16 at 7:32












7 Answers
7






active

oldest

votes


















24














You can set IQKeyboardManager below properties.



I assume you have enabled the IQKeyboardManager in didFinishLaunch of app delegate like this



    IQKeyboardManager.sharedManager().enable = true


shouldShowTextFieldPlaceholder to false ==> If you want to hide placeholder toolbar section



shouldHidePreviousNext to false ==> If you want to hide next and prev button and so on.



You can enable the settings in didFinishLaunch of AppDelegate like this



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

IQKeyboardManager.sharedManager().enable = true

IQKeyboardManager.sharedManager().enableAutoToolbar = false
IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
IQKeyboardManager.sharedManager().shouldHidePreviousNext = false


return true
}





share|improve this answer


























  • can you help me with this one too: stackoverflow.com/questions/40124131/…

    – Gijo Varghese
    Oct 19 '16 at 7:34











  • I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

    – user7372676
    May 10 '17 at 4:53











  • shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

    – MAhipal Singh
    Aug 30 '17 at 9:27






  • 1





    to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

    – Manvir Singh
    Dec 12 '17 at 6:09











  • can I hide toolbar for just a specific textfield?

    – Mashhadi
    Jan 1 at 8:05



















8














You can enable or disable the toolbar in didFinishLaunchingWithOptions of AppDelegate:



IQKeyboardManager.sharedManager().enable = true

IQKeyboardManager.sharedManager.enableAutoToolbar = false


For more info see Properties and functions usage






share|improve this answer
























  • can I hide toolbar for just a specific textfield?

    – Mashhadi
    Jan 1 at 8:05



















5














Swift 3
You must use shouldResignOnTouchOutside to resign textField if touched outside of UITextField/UITextView.



Add this in your ViewController if you want it in an specific ViewController or to override all your application in the file AppDelegate.



Inside the method:



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
IQKeyboardManager.sharedManager().enable = true
IQKeyboardManager.sharedManager().enableAutoToolbar = false
IQKeyboardManager.sharedManager().shouldShowToolbarPlaceholder = false
IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
}





share|improve this answer


























  • This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

    – BuvinJ
    Oct 25 '17 at 22:11



















0














If you want to hide for a specific controller, you can do like this :





  • import IQKeyboardManagerSwift in your the desired View Controller.


  • Add this extension :



    // MARK: - Helper
    extension <#yourViewController#> {

    private func keyboardManagerVisible(_ state: Bool) {
    IQKeyboardManager.shared.enableAutoToolbar = state
    }
    }



  • Implement this in the life cycle :



    override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    self.keyboardManagerVisible(false)
    }

    override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)

    self.keyboardManagerVisible(true)
    }







share|improve this answer































    0














    Enable IQKeyboardManager in Swift 4



    Maybe try this:



    func application(_ application: UIApplication, 
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    //Your other code here

    // -- enable IQKeyboardManager --
    IQKeyboardManager.shared.enable = false

    return true
    }





    share|improve this answer

































      0














      Swift 4.2 , Xcode 10.1



      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

      IQKeyboardManager.shared.enable = true
      IQKeyboardManager.shared.enableAutoToolbar = false
      IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
      IQKeyboardManager.shared.shouldResignOnTouchOutside = true

      return true
      }





      share|improve this answer































        0














        Swift 4.0 and above For hide previous Next



        IQKeyboardManager.shared.previousNextDisplayMode = .alwaysHide


        Swift 4.0 and above For toolbar



        IQKeyboardManager.shared.enableAutoToolbar = false





        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40124364%2fhow-to-hide-toolbar-in-iqkeyboardmanager-ios-swift-3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          7 Answers
          7






          active

          oldest

          votes








          7 Answers
          7






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          24














          You can set IQKeyboardManager below properties.



          I assume you have enabled the IQKeyboardManager in didFinishLaunch of app delegate like this



              IQKeyboardManager.sharedManager().enable = true


          shouldShowTextFieldPlaceholder to false ==> If you want to hide placeholder toolbar section



          shouldHidePreviousNext to false ==> If you want to hide next and prev button and so on.



          You can enable the settings in didFinishLaunch of AppDelegate like this



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          // Override point for customization after application launch.

          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
          IQKeyboardManager.sharedManager().shouldHidePreviousNext = false


          return true
          }





          share|improve this answer


























          • can you help me with this one too: stackoverflow.com/questions/40124131/…

            – Gijo Varghese
            Oct 19 '16 at 7:34











          • I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

            – user7372676
            May 10 '17 at 4:53











          • shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

            – MAhipal Singh
            Aug 30 '17 at 9:27






          • 1





            to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

            – Manvir Singh
            Dec 12 '17 at 6:09











          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05
















          24














          You can set IQKeyboardManager below properties.



          I assume you have enabled the IQKeyboardManager in didFinishLaunch of app delegate like this



              IQKeyboardManager.sharedManager().enable = true


          shouldShowTextFieldPlaceholder to false ==> If you want to hide placeholder toolbar section



          shouldHidePreviousNext to false ==> If you want to hide next and prev button and so on.



          You can enable the settings in didFinishLaunch of AppDelegate like this



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          // Override point for customization after application launch.

          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
          IQKeyboardManager.sharedManager().shouldHidePreviousNext = false


          return true
          }





          share|improve this answer


























          • can you help me with this one too: stackoverflow.com/questions/40124131/…

            – Gijo Varghese
            Oct 19 '16 at 7:34











          • I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

            – user7372676
            May 10 '17 at 4:53











          • shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

            – MAhipal Singh
            Aug 30 '17 at 9:27






          • 1





            to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

            – Manvir Singh
            Dec 12 '17 at 6:09











          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05














          24












          24








          24







          You can set IQKeyboardManager below properties.



          I assume you have enabled the IQKeyboardManager in didFinishLaunch of app delegate like this



              IQKeyboardManager.sharedManager().enable = true


          shouldShowTextFieldPlaceholder to false ==> If you want to hide placeholder toolbar section



          shouldHidePreviousNext to false ==> If you want to hide next and prev button and so on.



          You can enable the settings in didFinishLaunch of AppDelegate like this



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          // Override point for customization after application launch.

          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
          IQKeyboardManager.sharedManager().shouldHidePreviousNext = false


          return true
          }





          share|improve this answer















          You can set IQKeyboardManager below properties.



          I assume you have enabled the IQKeyboardManager in didFinishLaunch of app delegate like this



              IQKeyboardManager.sharedManager().enable = true


          shouldShowTextFieldPlaceholder to false ==> If you want to hide placeholder toolbar section



          shouldHidePreviousNext to false ==> If you want to hide next and prev button and so on.



          You can enable the settings in didFinishLaunch of AppDelegate like this



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          // Override point for customization after application launch.

          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowTextFieldPlaceholder = false
          IQKeyboardManager.sharedManager().shouldHidePreviousNext = false


          return true
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 7 '17 at 16:29









          Martin Mlostek

          1,0731432




          1,0731432










          answered Oct 19 '16 at 7:32









          WolverineWolverine

          3,48211841




          3,48211841













          • can you help me with this one too: stackoverflow.com/questions/40124131/…

            – Gijo Varghese
            Oct 19 '16 at 7:34











          • I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

            – user7372676
            May 10 '17 at 4:53











          • shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

            – MAhipal Singh
            Aug 30 '17 at 9:27






          • 1





            to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

            – Manvir Singh
            Dec 12 '17 at 6:09











          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05



















          • can you help me with this one too: stackoverflow.com/questions/40124131/…

            – Gijo Varghese
            Oct 19 '16 at 7:34











          • I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

            – user7372676
            May 10 '17 at 4:53











          • shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

            – MAhipal Singh
            Aug 30 '17 at 9:27






          • 1





            to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

            – Manvir Singh
            Dec 12 '17 at 6:09











          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05

















          can you help me with this one too: stackoverflow.com/questions/40124131/…

          – Gijo Varghese
          Oct 19 '16 at 7:34





          can you help me with this one too: stackoverflow.com/questions/40124131/…

          – Gijo Varghese
          Oct 19 '16 at 7:34













          I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

          – user7372676
          May 10 '17 at 4:53





          I want to hide previous/next button but [[IQKeyboardManager sharedManager] shouldHidePreviousNext] = YES; throwing me an error shouldHidePreviousNext is not available... Any help appreciated...

          – user7372676
          May 10 '17 at 4:53













          shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

          – MAhipal Singh
          Aug 30 '17 at 9:27





          shouldHidePreviousNext has deprecated, in this place use previousNextDisplayMode

          – MAhipal Singh
          Aug 30 '17 at 9:27




          1




          1





          to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

          – Manvir Singh
          Dec 12 '17 at 6:09





          to hide next previous key use:- IQKeyboardManager.sharedManager().previousNextDisplayMode = IQPreviousNextDisplayMode.alwaysHide

          – Manvir Singh
          Dec 12 '17 at 6:09













          can I hide toolbar for just a specific textfield?

          – Mashhadi
          Jan 1 at 8:05





          can I hide toolbar for just a specific textfield?

          – Mashhadi
          Jan 1 at 8:05













          8














          You can enable or disable the toolbar in didFinishLaunchingWithOptions of AppDelegate:



          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager.enableAutoToolbar = false


          For more info see Properties and functions usage






          share|improve this answer
























          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05
















          8














          You can enable or disable the toolbar in didFinishLaunchingWithOptions of AppDelegate:



          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager.enableAutoToolbar = false


          For more info see Properties and functions usage






          share|improve this answer
























          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05














          8












          8








          8







          You can enable or disable the toolbar in didFinishLaunchingWithOptions of AppDelegate:



          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager.enableAutoToolbar = false


          For more info see Properties and functions usage






          share|improve this answer













          You can enable or disable the toolbar in didFinishLaunchingWithOptions of AppDelegate:



          IQKeyboardManager.sharedManager().enable = true

          IQKeyboardManager.sharedManager.enableAutoToolbar = false


          For more info see Properties and functions usage







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 19 '16 at 7:34









          Bhavin RamaniBhavin Ramani

          2,81652537




          2,81652537













          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05



















          • can I hide toolbar for just a specific textfield?

            – Mashhadi
            Jan 1 at 8:05

















          can I hide toolbar for just a specific textfield?

          – Mashhadi
          Jan 1 at 8:05





          can I hide toolbar for just a specific textfield?

          – Mashhadi
          Jan 1 at 8:05











          5














          Swift 3
          You must use shouldResignOnTouchOutside to resign textField if touched outside of UITextField/UITextView.



          Add this in your ViewController if you want it in an specific ViewController or to override all your application in the file AppDelegate.



          Inside the method:



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          IQKeyboardManager.sharedManager().enable = true
          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowToolbarPlaceholder = false
          IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
          }





          share|improve this answer


























          • This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

            – BuvinJ
            Oct 25 '17 at 22:11
















          5














          Swift 3
          You must use shouldResignOnTouchOutside to resign textField if touched outside of UITextField/UITextView.



          Add this in your ViewController if you want it in an specific ViewController or to override all your application in the file AppDelegate.



          Inside the method:



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          IQKeyboardManager.sharedManager().enable = true
          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowToolbarPlaceholder = false
          IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
          }





          share|improve this answer


























          • This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

            – BuvinJ
            Oct 25 '17 at 22:11














          5












          5








          5







          Swift 3
          You must use shouldResignOnTouchOutside to resign textField if touched outside of UITextField/UITextView.



          Add this in your ViewController if you want it in an specific ViewController or to override all your application in the file AppDelegate.



          Inside the method:



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          IQKeyboardManager.sharedManager().enable = true
          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowToolbarPlaceholder = false
          IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
          }





          share|improve this answer















          Swift 3
          You must use shouldResignOnTouchOutside to resign textField if touched outside of UITextField/UITextView.



          Add this in your ViewController if you want it in an specific ViewController or to override all your application in the file AppDelegate.



          Inside the method:



          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
          IQKeyboardManager.sharedManager().enable = true
          IQKeyboardManager.sharedManager().enableAutoToolbar = false
          IQKeyboardManager.sharedManager().shouldShowToolbarPlaceholder = false
          IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 '17 at 6:28









          onCompletion

          3,92532030




          3,92532030










          answered Oct 25 '17 at 21:03









          MrMinsMrMins

          5,99354490




          5,99354490













          • This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

            – BuvinJ
            Oct 25 '17 at 22:11



















          • This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

            – BuvinJ
            Oct 25 '17 at 22:11

















          This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

          – BuvinJ
          Oct 25 '17 at 22:11





          This was flagged as a low quality post. Please add some explanatory text and clean up the formatting of the code block.

          – BuvinJ
          Oct 25 '17 at 22:11











          0














          If you want to hide for a specific controller, you can do like this :





          • import IQKeyboardManagerSwift in your the desired View Controller.


          • Add this extension :



            // MARK: - Helper
            extension <#yourViewController#> {

            private func keyboardManagerVisible(_ state: Bool) {
            IQKeyboardManager.shared.enableAutoToolbar = state
            }
            }



          • Implement this in the life cycle :



            override func viewDidAppear(_ animated: Bool) {
            super.viewDidAppear(animated)

            self.keyboardManagerVisible(false)
            }

            override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)

            self.keyboardManagerVisible(true)
            }







          share|improve this answer




























            0














            If you want to hide for a specific controller, you can do like this :





            • import IQKeyboardManagerSwift in your the desired View Controller.


            • Add this extension :



              // MARK: - Helper
              extension <#yourViewController#> {

              private func keyboardManagerVisible(_ state: Bool) {
              IQKeyboardManager.shared.enableAutoToolbar = state
              }
              }



            • Implement this in the life cycle :



              override func viewDidAppear(_ animated: Bool) {
              super.viewDidAppear(animated)

              self.keyboardManagerVisible(false)
              }

              override func viewWillDisappear(_ animated: Bool) {
              super.viewWillDisappear(animated)

              self.keyboardManagerVisible(true)
              }







            share|improve this answer


























              0












              0








              0







              If you want to hide for a specific controller, you can do like this :





              • import IQKeyboardManagerSwift in your the desired View Controller.


              • Add this extension :



                // MARK: - Helper
                extension <#yourViewController#> {

                private func keyboardManagerVisible(_ state: Bool) {
                IQKeyboardManager.shared.enableAutoToolbar = state
                }
                }



              • Implement this in the life cycle :



                override func viewDidAppear(_ animated: Bool) {
                super.viewDidAppear(animated)

                self.keyboardManagerVisible(false)
                }

                override func viewWillDisappear(_ animated: Bool) {
                super.viewWillDisappear(animated)

                self.keyboardManagerVisible(true)
                }







              share|improve this answer













              If you want to hide for a specific controller, you can do like this :





              • import IQKeyboardManagerSwift in your the desired View Controller.


              • Add this extension :



                // MARK: - Helper
                extension <#yourViewController#> {

                private func keyboardManagerVisible(_ state: Bool) {
                IQKeyboardManager.shared.enableAutoToolbar = state
                }
                }



              • Implement this in the life cycle :



                override func viewDidAppear(_ animated: Bool) {
                super.viewDidAppear(animated)

                self.keyboardManagerVisible(false)
                }

                override func viewWillDisappear(_ animated: Bool) {
                super.viewWillDisappear(animated)

                self.keyboardManagerVisible(true)
                }








              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 24 '18 at 9:02









              MaximelcMaximelc

              1,0721316




              1,0721316























                  0














                  Enable IQKeyboardManager in Swift 4



                  Maybe try this:



                  func application(_ application: UIApplication, 
                  didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

                  //Your other code here

                  // -- enable IQKeyboardManager --
                  IQKeyboardManager.shared.enable = false

                  return true
                  }





                  share|improve this answer






























                    0














                    Enable IQKeyboardManager in Swift 4



                    Maybe try this:



                    func application(_ application: UIApplication, 
                    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

                    //Your other code here

                    // -- enable IQKeyboardManager --
                    IQKeyboardManager.shared.enable = false

                    return true
                    }





                    share|improve this answer




























                      0












                      0








                      0







                      Enable IQKeyboardManager in Swift 4



                      Maybe try this:



                      func application(_ application: UIApplication, 
                      didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

                      //Your other code here

                      // -- enable IQKeyboardManager --
                      IQKeyboardManager.shared.enable = false

                      return true
                      }





                      share|improve this answer















                      Enable IQKeyboardManager in Swift 4



                      Maybe try this:



                      func application(_ application: UIApplication, 
                      didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

                      //Your other code here

                      // -- enable IQKeyboardManager --
                      IQKeyboardManager.shared.enable = false

                      return true
                      }






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 25 '18 at 16:02

























                      answered Nov 25 '18 at 14:53









                      Mahesh ChaudhariMahesh Chaudhari

                      18714




                      18714























                          0














                          Swift 4.2 , Xcode 10.1



                          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

                          IQKeyboardManager.shared.enable = true
                          IQKeyboardManager.shared.enableAutoToolbar = false
                          IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
                          IQKeyboardManager.shared.shouldResignOnTouchOutside = true

                          return true
                          }





                          share|improve this answer




























                            0














                            Swift 4.2 , Xcode 10.1



                            func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

                            IQKeyboardManager.shared.enable = true
                            IQKeyboardManager.shared.enableAutoToolbar = false
                            IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
                            IQKeyboardManager.shared.shouldResignOnTouchOutside = true

                            return true
                            }





                            share|improve this answer


























                              0












                              0








                              0







                              Swift 4.2 , Xcode 10.1



                              func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

                              IQKeyboardManager.shared.enable = true
                              IQKeyboardManager.shared.enableAutoToolbar = false
                              IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
                              IQKeyboardManager.shared.shouldResignOnTouchOutside = true

                              return true
                              }





                              share|improve this answer













                              Swift 4.2 , Xcode 10.1



                              func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

                              IQKeyboardManager.shared.enable = true
                              IQKeyboardManager.shared.enableAutoToolbar = false
                              IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
                              IQKeyboardManager.shared.shouldResignOnTouchOutside = true

                              return true
                              }






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Dec 13 '18 at 14:36









                              Kedar SukerkarKedar Sukerkar

                              312




                              312























                                  0














                                  Swift 4.0 and above For hide previous Next



                                  IQKeyboardManager.shared.previousNextDisplayMode = .alwaysHide


                                  Swift 4.0 and above For toolbar



                                  IQKeyboardManager.shared.enableAutoToolbar = false





                                  share|improve this answer




























                                    0














                                    Swift 4.0 and above For hide previous Next



                                    IQKeyboardManager.shared.previousNextDisplayMode = .alwaysHide


                                    Swift 4.0 and above For toolbar



                                    IQKeyboardManager.shared.enableAutoToolbar = false





                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      Swift 4.0 and above For hide previous Next



                                      IQKeyboardManager.shared.previousNextDisplayMode = .alwaysHide


                                      Swift 4.0 and above For toolbar



                                      IQKeyboardManager.shared.enableAutoToolbar = false





                                      share|improve this answer













                                      Swift 4.0 and above For hide previous Next



                                      IQKeyboardManager.shared.previousNextDisplayMode = .alwaysHide


                                      Swift 4.0 and above For toolbar



                                      IQKeyboardManager.shared.enableAutoToolbar = false






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jan 8 at 13:06









                                      Bhargav SejpalBhargav Sejpal

                                      187




                                      187






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40124364%2fhow-to-hide-toolbar-in-iqkeyboardmanager-ios-swift-3%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Costa Masnaga

                                          Fotorealismo

                                          Sidney Franklin