iOS 8 Dismiss keyboard for swift

swipe down to dismiss keyboard swift
swift hide keyboard programmatically
swift dismiss keyboard on return
uitextfield dismiss keyboard tap outside
resignfirstresponder not dismissing keyboard
disable keyboard uitextfield swift
swift uitextfield dismiss keyboard on return
swift keyboard done button

i'm a beginner in swift and i have been using this dismissKeyboard() method but it is not working for the keyboard extension.

@IBAction func donePressed (sender: UIButton) {

      dismissKeyboard()


    }

can anyone tell me why this doesn't work?

thanks.

EDIT: full code

import UIKit

class KeyboardViewController: UIInputViewController {

var keyboardView: UIView!

@IBOutlet var nextKeyboardButton: UIButton!

override func updateViewConstraints() {
    super.updateViewConstraints()

    // Add custom view sizing constraints here
}

override func viewDidLoad() {
    super.viewDidLoad()

  self.loadInterface()





}


func loadInterface() {

    var keyboardNib = UINib(nibName: "KeyboardView", bundle: nil)

    self.keyboardView = keyboardNib.instantiateWithOwner(self, options: nil)[0] as UIView

    view.addSubview(self.keyboardView)

    view.backgroundColor = self.keyboardView.backgroundColor

    self.nextKeyboardButton.addTarget(self, action: "advanceToNextInputMode", forControlEvents: .TouchUpInside)

    self.nextKeyboardButton.addTarget(self, action: "advanceToNextInputMode", forControlEvents: .TouchUpInside)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated
}

override func textWillChange(textInput: UITextInput) {
    // The app is about to change the document's contents. Perform any preparation here.
}

override func textDidChange(textInput: UITextInput) {
    // The app has just changed the document's contents, the document context has been updated.

}

@IBAction func buttonPressed (sender: UIButton) {

    let title = sender.titleForState(.Normal)

    var proxy = textDocumentProxy as UITextDocumentProxy

    proxy.insertText(title!)

}

@IBAction func spacePressed (sender: UIButton) {

    var proxy = textDocumentProxy as UITextDocumentProxy

    proxy.insertText(" ")

}

@IBAction func deletePressed (sender: UIButton) {

    var proxy = textDocumentProxy as UITextDocumentProxy

    proxy.deleteBackward()

}

@IBAction func donePressed (sender: UIButton) {

resignFirstResponder()


}

}

Try like that

self.dismissKeyboard()

Best way to dismiss Keyboard in a View Controller iOS (Swift), I was thinking to write about all possible ways to dismiss the keyboard in iOS app and let people figure out which one is best suited one. A custom keyboard replaces the system keyboard for users who want capabilities such as a novel text input method or the ability to enter text in a language not otherwise supported in iOS. The essential function of a custom keyboard is simple: Respond to taps, gestures, or other input events and provide text, in the form of an unattributed

Maybe try :

view.endEditing(true)

iPhone Apps 101, iPhone Apps 101 - Dismiss the UITextField Keyboard by Pressing the Return Key in Swift 4 Duration: 13:12 Posted: Feb 15, 2018 How to dismiss the keyboard in iOS 10 with Swift 3. - dismiss-keyboard.swift

Dismisses the custom keyboard from the screen.

Swift:

self.dismissKeyboard()

Objective-C:

[self dismissKeyboard];

https://developer.apple.com/documentation/uikit/uiinputviewcontroller/1618196-dismisskeyboard?language=objc

How To Hide The Keyboard In xCode 8 (Swift 3.0), In this video, I show you how you can hide the keyboard by either clicking outside the keyboard Duration: 3:54 Posted: Sep 7, 2016 Select and install the keyboard. The next time you open the keyboard you should be able to see your new keyboard by pressing the next keyboard button. If you are using the iOS Simulator, the custom keyboard might not work inside your app. To see the keyboard press home and open Spotlight. Step 8: Next Keyboard

Ios dismiss keyboard programmatically, How to dismiss iOS keyboard programatically (Swift 5) - "Handling Keyboard in that would be our text Windows 8: Hide Virtual Keyboard Programmatically The� It dismisses the keyboard when the user taps the Return key, and; it dismisses the keyboard when the user taps on the background. Last week, I covered implementing the first of these two features in the article titled How to dismiss the iOS keyboard when the user taps the “Return” key in Swift.

Swift dismiss keyboard, AB Jan 12, 2020 � Dismiss Keyboard with Swift in iOS app. Watch Queue Queue Feb 15, This tutorial was written using Swift 3 and Xcode 8. 100 Days of Swif t. In the code, we call the sendAction method to resign the first responder and dismiss the keyboard. You can now run the app using a simulator. When you tap the cancel button, it should clear the search field and dismiss the software keyboard. Summary. In this tutorial, we showed you how to implement a search bar.

dismiss keyboard when tap outside swift Code Example, Get code examples like "dismiss keyboard when tap outside swift" instantly right 8. . 9. @objc func dismissKeyboard() {. 10. view.endEditing(true) tap outside swift � Close iOS Keyboard by touching anywhere using Swift� Custom keyboard for iOS 8 using Swift. Contribute to jonomuller/Hodor-Keyboard development by creating an account on GitHub.

Comments
  • resignFirstResponder() call this method instead of dismissKeyboard() but you need to call with the textFieldDemo.resignFirstResponder() like that.... Where is your instance of textField.....
  • There is no text field, its just a custom keyboard for the iphone
  • ok you simply call resignFirstResponder() and let me know
  • i tried using it in safari and the calendar
  • it didn't work , the resignFirstResponder()