Swift hide keyboard

youtTextField. Dec 9, 2010 · 10. Users expect that tapping outside a text field or submit will dismiss the keyboard. – Link for the Video i suggest you to watch before this :- https://www. immediately to make the keyboard dismiss fully as soon as any scroll happens. leadingBarButtonGroups = [] with a textfield. resignFirstResponder() This method will be invoked when user click search button on keyboard. let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIViewController. keyboardDismissMode = . startButton. inputView = YourKeyboard() EDIT 2. It works perfectly for dismissing the keyboard with your solution, what about if the text field is at the bottom of the page. Example: I have seven TextField inside my main ContentView. Mar 15, 2011 · Create the action to hide the keyboard. 2. becomeFirstResponder() } Notes. removeAll() or inputAssistantItem. Name. delegate = self. var body: some View {. In iOS, iPadOS, tvOS, and visionOS, the system provides various types of Jan 18, 2022 · I am using the following View extension to add an underlying, hidden button to the View hierarchy: extension View { /// Adds an underlying hidden button with a performing action that is triggered on pressed shortcut /// - Parameters: /// - key: Key equivalents consist of a letter, punctuation, or function key that can be combined with an optional set of modifier keys to specify a keyboard Mar 31, 2020 · SwiftUI will automatically update the view whenever the keyboard height changes. Swiftui - Disable Keyboard from showing up for TextField. Here is my code in my viewDidLoad. Here is all the code I have written: var user: OfficialUserModel. onReceive() captures key entry; it checks whether the last char entered in the string is a newline (ASCII 10), and if so triggers the un focus. struct KeyboardView<Content, ToolBar> : View where Content : View, ToolBar: View { @StateObject private var 1 - How to access the Toolbar. Microsoft SwiftKey does not have a dedicated minimize keyboard button. The first step is to subscribe to the will show and will hide keyboard animations. hide keyboard for TextField with Edited Changed. dismissKeyboard)) tap. The simple way is to connect the delegate of UITextField to self ( self. func hideKeyboardWhenTappedAround() {. Aug 28, 2020 · Enter UIResponder. extension UIViewController {. Use your personalized keyboard to type and send emoji, GIFs and stickers just the way you like. submitLabel(. Once you have your outlets connected, simply change the isHidden property to true. inputAssistantItem. done) however the keyboard simply changes the button to blue and changes the label but when you press it, it still returns a new line in the Aug 13, 2021 · Using this protocol, KeyboardReadable, you can conform to any View and get keyboard updates from it. I have just added the text field delegate method and I used textFieldShouldReturn delegate method which is a responsible "return" key action. If you used some other object to bring up the keyboard, simply take the reference of whatever you used and call resignFirstResponder() on that object. java. } answered Dec 19, 2016 at 19:54. textField . If the text field is set up in a storyboard you can May 3, 2020 · Subscribe To Keyboard Show And Hide Notifications. If all that worked, then the keyboard should go away whenever the Done button is tapped. onSubmit modifier. Now, when focusing and defocusing the text field, the view will move up and down: May 24, 2020 · Well I am new in SwiftUI I found a code, just I need put that after the curly bracket in //NavigationView then dismiss the keyboard when I start scrolling. Jan 31, 2020 · You can change the return key for each textField with a simple modifier called: submitLabel that takes the return key type: Image from WWDC21. } After using inputAccessoryView view included with textfield comes on top of the keyboard, but when I click on the return button to hide the keyboard. inputView = UIView() so putting your custom view can make the work. In iOS 15, SwiftUI got a native way to dismiss the keyboard programmatically using a new property wrapper, @FocusState, in conjunction with focused(_:) modifier. and of course it's a problem only on iPhone x and up because of the new design. automatic (default): SwiftUI decides the best behavior based on the context. I'm trying to change the keyboard though so that rather than having a grey return key, the button says Done. I have looked at many tutorials online and replicated them exactly but none of them seem to work. endEditing(true). backButton. The @FocusState property will allow you to track when the keyboard is shown, on the other hand if try this with IF ELSE the app will crash due an overlap of animations and the way the if else works in swiftUI. mytestField. Overview. Although I would prefer to create a helper to wrap up the notification's observers. Defining dismissKeyboard() function which ends editing on UIApplication. Here is the sample code for adding Done button in the Toolbar and hide keyboard on that button click. scrollView endEditing: YES]; Mar 24, 2017 · mUserNameEdit. Then add this to the implementation file of the same ViewController: Jul 29, 2018 · I am trying to build a custom keyboard for general use across many apps. cancelsTouchesInView = false. isHidden(true) Or for complete removal: Feb 7, 2018 · You can add gestures to dismiss the keyboard with a touch or swipe. Mar 8, 2015 · First you need to set delegate for your textfield then you need to include resignFirstResponder() to hide keyboard when press return button of keybaord. So I want to move all TextField up respectively when the keyboard has appeared. plain, target: self, action: #selector(dismissMyKeyboard)) 12. @ObservedObject private var vm = TheUserModel() Oct 4, 2020 · Create a generic view which takes content and toolbar view callbacks as parameter. Microsoft SwiftKey learns your writing style to suggest your next word. Next tap ‘Backup & Sync’. – leolobato Dec 13, 2021 at 9:14 Apr 21, 2024 · Here’s how to use it: You can provide an argument to the scrollDismissesKeyboard modifier to specify how the keyboard should dismiss: . return NO to ignore. Alternatively, you can do that directly in the Storyboard or XIB. endEditing(_:))) endEditingTapGesture. Mar 22, 2015 · let tapGesture = UITapGestureRecognizer(target: self, action: Selector("hideKeyboard")) tapGesture. } set (hasDone) { if hasDone{ addDoneButtonOnKeyboard() } } } func addDoneButtonOnKeyboard() { let doneToolbar: UIToolbar = UIToolbar(frame: CGRect. Here are some reasons why: If the keyboard remains visible after they finish entering text, it can obstruct other content. super. Use . protocol KeyboardReadable { var keyboardPublisher: AnyPublisher<Bool, Never> { get } } extension KeyboardReadable { var keyboardPublisher: AnyPublisher<Bool, Never> { Publishers. UIKeyboardWillShow, object: nil Feb 9, 2021 · How keyboard avoidance works. Update the view state with the latest value emitted by the keyboardHeight publisher. keyboardWillShow), name: NSNotification. let endEditingTapGesture = UITapGestureRecognizer(target: view, action: #selector(UIView. iOS hide keyboard on touch textfield swift 2. endEditing(true) super. @State private var text = "" ScrollView { TextField("Prompt NSValue else { return } let keyboardScreenEndFrame = keyboardValue. xml file. addObserver( self, selector: #selector(keyboardWillShow(_:)), name: UIResponder Mar 14, 2022 · In this tutorial we will get to know that how to hide keyboard or you can say how to work with the @FocusState in SwiftUI. I also have an extension for a View that lets me programmatically hide the keybard, for when I hit save etc and want the keyboard to close. Alternatively, pressing your phone’s back key will minimize Microsoft SwiftKey. public var body: some View {. IBOutlet weak var backButton: UIButton. To automatically show the keyboard, to the following: override func viewDidLoad() { super. struct KeyboardView: View {. <activity android:name=". interactively to make the keyboard dismiss inline with the user’s gesture – they need to scroll further to make it dismiss fully. Also, as you can see, you can have a callback to handle the return key press action just like the old textFieldShouldReturn function that is accessible by . var datePickerView : UIDatePicker = UIDatePicker() datePickerView. datePickerMode = UIDatePickerMode. focused() modifier on the view triggers attaches a trigger to the TextEditor to enable you to programmatically focus (show) or unfocus (dismiss) the keyboard. With Swift 5. Dec 7, 2010 · Swift 5. Control drag from the 'Did End on Exit' to the above function in your swift file. This solution seems good enough but not all keyboards have return button. All the posts on the forum that I have seen so far refer to using inputAssistantItem. KeyboardReadable protocol:. endEditing(true) } Feb 24, 2020 · 1. Just tap the icon to the left of the prediction bar to open/expand Toolbar. endEditing(true) } Translating Objective-C code to Swift is not really hard. Don't apply it on TextField! Otherwise we are on the beginning of the story again :-) This modifier will help us to solve the trouble with Picker but not with the Button. Step 1 − In this step, will create and customize the UITextField object to enter the email address. Only one line in the action —— scrollView. You can ask AI anything in your favourite apps. @IBOutlet var dateField: UITextField! = UITextField() @IBOutlet var timeField: UITextField! = UITextField() @IBAction func userPickDate(sender: UITextField) {. Step 2 − In this step, will conform the UITextField’s delegate and implement the textFieldShouldReturn method to hide the Oct 18, 2022 · Calling the dismiss keyboard method on the click of "Dismiss Keyboard" button. February 2, 2024. [[UIBarButtonItem alloc]initWithTitle:@"Done Nov 13, 2019 · In this Swift iOS tutorial, we will go over 3 ways to dismiss the keyboard on an iOS device. And the . Instead, if you slide a finger down the keys from top to bottom, your Microsoft SwiftKey Keyboard is minimized. delegate = self) and dismiss the keyboard in the method textFieldShouldReturn using [textField resignFirstResponder]; Another way to dismiss the keyboard is the following: Objective-C. I do all of this is xCode 8 with Swif Aug 15, 2014 · hide keyboard for text field in swift programming language. The benefit: You don't have to repeat each time you handle the keyboard behaviors. Every device has a safe area: when a system keyboard is shown, this safe area will grow, reducing the space proposed to our SwiftUI views, which will need to compress in order to make room for the keyboard. And then you have to change this: func textFieldShouldReturn(_ scoreText: UITextField) -> Bool {. answered Oct 11, 2016 at 2:09. here is my code. - (IBAction)dissmissKeyboardOnTap:(id)sender; @end. addGestureRecognizer(endEditingTapGesture) Apr 28, 2024 · In iOS development, handling the dismissal of the keyboard is essential for a smooth and user-friendly experience. addObserver(self, selector: #selector(CommentsController. Sep 18, 2018 · Sure. import SwiftUI. 11. NotificationCenter. T Customize the toolbar with your favorite typing tools at your fingertips, including GIFs, Clipboard, Translator, Stickers, and more. How to use Microsoft SwiftKey keyboard for Android devices with this guide you'll see how to set default keyboardkeyboard layoutkeyboard vibrationkeyboard mo Dec 13, 2021 · First way: Implement UITextFieldDelegate’s textFieldShouldReturn method and dismiss current keyboard. Repeat for any other textfield in that scene and link to the same function. It hides both keyboard and view both. The inputAccessoryView is the bar that sometimes appears above the keyboard. Clarified the virtual keyboard’s support for direct and indirect gestures in visionOS. Add padding to the bottom of the view, which will make it move up and down with the keyboard. Uncheck ‘Backup & Sync’ to disable this feature. In this tutorial, I have explained to you that, How to hide keyboard on tap in iOS with swift 5 programming language. VStack {. Then inside your view subscribe to keyboardFrame updates and show and hide the Done button accordingly: @State private var showDoneButton = false. leadingBarButtonGroups. isHidden = true. resignFirstResponder() Apr 27, 2017 · I am developing an swift 3 app that has a navigation bar in every page. About this app. override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { self. I think this is the right method. resignFirstResponder() return true; Oct 28, 2014 · to hide the keyboard touch on any part outside the textbox or textviews in swift 4 use this peace of code in the ViewController class: override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { view. com/watch?v=0RTZrtjGvf8This video explains you how to hide Keyboard from your a Dec 3, 2018 · Here are the screenshots before the keyboard: and here is when the keyboard is presented: as you can see I can't see the text field and button. That's what interactively means when you start the scrolling above the keyboard and go down the keyboard will go down with you and then dismiss it. So here we can dismiss keyboard. this is my code: Thank you for help me. init Dec 1, 2015 · Hide keyboard Swift. Hot Network Questions Help with "Roll XD12, and keep each middle dice as an Dec 17, 2014 · To enable SwiftKey and make it your default keyboard on stock Android, head to settings, select Language & input, and choose SwiftKey from the list of options. I need to resign the keyboard on touch of any object in the screen. If you have a UITextField on your page that brought it up, you can call textField. Apr 1, 2021 · For hiding textField: func textFieldShouldReturn(_ textField: UITextField) -> Bool {. @IBOutlet weak var text1: UITextField! @IBOutlet weak var text2: UITextField! override func viewDidLoad () {. The navigation bar also has a button in the left. onDrag. If you wish to have an option to preserve the space or want it as a modifier, see below. Try to put this. Apr 7, 2020 · So to wrap up: the emoji keyboard will always be hidden from the list of keyboards by using textField. textField. Please try to add below code to hide/show navigation-bar on hide/show of keyboard. 1. listview. Works for both UITextView and UITextField; To hide the keyboard use textView. Using this you can disable normal keyboard. It is the best way to solve the issue of “hide Aug 12, 2020 · Dismissing the UITextField’s Keyboard. To solve the first one you need to meet your second property wrapper: @FocusState. 0. import Combine import UIKit /// Publisher to read keyboard changes. default. @State private var text = "". It works for me. private enum Field: Int, CaseIterable {. Mar 3, 2011 · 7. Setting a label of text "Dismiss Keyboard" of the button. } . Dec 1, 2022 · You can now write hideKeyboard() from inside any SwiftUI view. For example, you can specify a value of immediately to indicate that you would like scrollable content to immediately dismiss the keyboard if present when a scroll drag gesture begins. //dismiss the keyboard. //Create a felxible space item so that we can add it around in toolbar to position our done button. How do you move the text field up so the keyboard doesn't hide it. var body: some View{. keyBoardUp(Notification :)), name: NSNotification. hideKeyboard()” in the viewDidLoad. Sarah Tew/CNET. touchesBegan(touches, with: event) } Regards 10. The keyboard is also About this app. class ViewController: UIViewController { override func viewDidLoad() { super. So here we will start with the basic ex Sep 7, 2016 · In this video, I show you how you can hide the keyboard by either clicking outside the keyboard or on the "return" key. You can use UITextField with UIViewRepresentable, which lets you stop the keyboard from showing up. Microsoft SwiftKey comes with Copilot - your everyday AI companion. Toolbar is easily accessible from your Microsoft SwiftKey Keyboard. Jul 6, 2023 · In Swift 5, you can hide the keyboard by touching anywhere on the screen with these two lines of code: let tapGesture = UITapGestureRecognizer(target: view, action: #selector (UIView. Mar 24, 2017 · Thanks for sharing this. We will learn about the Notificat May 10, 2023 · Use app delegate method: Another way to dismiss the keyboard is by using the app delegate method and calling endEditing() on UIApplication. Enter a whole word with a single tap, instead of typing letter by letter. Swift: Put [self. IBOutlet weak var startButton: UIButton. after this check your application if it is not working then add this line in your AndroidManifest. So, to dismiss the keyboard, we will utilise this Jul 18, 2023 · func scrollDismissesKeyboard(_ mode: ScrollDismissesKeyboardMode) -> some View. immediately) } This does not dismiss the keyboard on tap but on scroll which is the typical iOS behaviour. cancelsTouchesInView = true. But every text view out there gives the user some other way to get rid of the keyboard. func searchBarSearchButtonClicked(searchBar: UISearchBar) {. Tap ‘Delete’ to confirm. func textFieldShouldReturn(textField: UITextField!) -> Bool // called when 'return' key pressed. I would like to hide the Keyboard Shortcuts Bar, but I am struggling to do this. addGestureRecognizer(tapGesture) } func hideKeyboard() {. addObserver(self, selector: #selector(ViewController. Changed page title from Onscreen keyboards and updated to include guidance for visionOS. UIKeyboardWillShow, object: nil) And the function keyBoardUp below: Aug 16, 2021 · We can move our entire app screen up, so that we can see the UIViews(UITextField, UIButton etc) underneath the iOS keyboard. I created an extension, so you can use a modifier, like so to hide the view: Text("Hello World!") . keyboardFrame = keyboardScreenEndFrame. Lastly, you add that method to the view controller. This is th Apr 22, 2017 · In Swift, both [someTextField]. if you don't want the keyboard to dismiss like that you can dismiss the keyboard when scroll or drag down or up the textField itself like this. This is exactly like a regular @State property, except it’s specifically designed to handle input focus in our UI. If you wish to close your Toolbar, tap the icon to hide it. immediately: Hides the keyboard as soon as any scrolling starts. Then click View —> Inspectors —> Show Attributes Inspector menu item at Xcode top menu bar. struct ContentView : View { @State var textfieldText: String = "" var Apr 21, 2018 · This video is about How to Dismiss Keyboard when you press Return key on keyboard. requestFocus(); and this line in your AppList. Dec 16, 2020 at 16:14. @State var placHolder: String = "Enter username". 1) when user touches screen other than keyboard or textfield (touchesBegan)2) When Add a tap gesture recogniser from the Main Storyboard to your view. keyboardType = . Code: https://swif Aug 2, 2017 · hide keyboard for text field in swift programming language. view endEditing:YES]; where you would like to dismiss Nov 30, 2017 · In this video i will show how to hide keyboard using two methods in swift. December 5, 2023. You probably want the immediately mode. Mar 3, 2023 · 0. There are a few ways to do this, but this is the way I usually do it. // etc. AppLogin" android:configChanges="keyboardHidden|orientation"></activity>. If you are using Objective-C, [self. Merge Mar 21, 2017 · In Swift. Seamlessly type in multiple languages without switching settings. – Raja Kishan. Tap ‘Account’. I tried with the usual. viewDidLoad () 20. case username, password. Mar 12, 2022 · How can I hide keyboard after user picks some date in DatePicker? Currently when I tap on the name TextField, and then - with keyboard shown up - I tap on DatePicker, the keyboards hides when DatePicker's popup window for choosing date appears, but after I pick some date in DatePicker's popup window, keyboard appears again. Documentation. Inside the @IBAction dismiss your keyboard (or do anything else) Replace the "UITextField" with the name of the textfield that you want to dismiss the keyboard from. interactively: Hides the keyboard as the user scrolls further Mar 10, 2023 · Hello, I have a TextEditor in my app where users can enter a small amount of text using a default keyboard. addGestureRecognizer(tapGesture) This code adds a tap gesture recognizer into the current view that listens for actions that suggest that the Apr 17, 2017 · Simple and easy for all view controller swift 3+. Just replace this class with your and your second part problem is solved (Dismiss keyboard on "return" key) – Raja Kishan. elarcoiris. Jun 7, 2022 · Use . Scroll down to the Text Input Traits section, there are three drop-down lists related to the keyboard. Nov 17, 2018 · In this video, I'll show you how to hide the keyboard when the user presses the Return key and when the user Taps in any part of the View. When user open keyboard some of the TextField are hidden under the keyboard frame. @State var text: String = "". For example, the user can swipe down, or there's a button that closes the keyboard, or you add an accessory view. Jan 5, 2021 · The . Added artwork for visionOS. Spacer() Dec 16, 2020 · 1. From the Account menu tap 'Delete personalized dictionary backup' (this will remove any data already associated with your account). I am trying to run a function when the keyboard shows and disappears and have the following code: let notificationCenter = NotificationCenter. Oct 8, 2023 · We need to add some kind of button to remove that focus when the user wants, which will in turn cause the keyboard to go away. endEditing(true) return false. Jan 18, 2017 · 20. We are going to override the method touchesBegan:withEvent: for the ViewController itself. Add this to the header file of the class used by your ViewController: @interface TimeDelayViewController : UIViewController <UITextFieldDelegate>. , is good But I would like activate that when I choose the percentage in my app. Create an @IBAction to your ViewController file. view. IBAction func tapStart(sender: AnyObject?){. asciiCapable but won't be hidden on the keyboard itself if the user has 4 keyboards (in this case: English, Danish, Swedish and Emoji). Jun 16, 2016 · swift 4 Add this to your viewDidLoad. I understand that the former is specific to a particular field, while the latter encompasses the entire view, but other than wanting to target Feb 28, 2023 · In this example, we will hide the keyboard in UITextField to enter an email address by following the below steps −. Now, go to your ViewController’s Swift file. storyboard file to select it. } First, your class must include the UITextFieldDelegate protocol: class yourClass: UIViewController, UITextFieldDelegate { And in the viewDidLoad() method, add this as well: scoreText. To do this follow these steps: Open the Microsoft SwiftKey app from your device. How you use that depends on your code, but here’s a simple example that shows a decimal pad text field with a button to dismiss it: See full list on programmingwithswift. List {. This method resigns the first responder of the view. resignFirstResponder! Per Apple’s documentation UIResponder is an abstract interface for responding to and handling events. removeAll() Feb 28, 2011 · Setting the keyboard to disappear when the scrollView is scrolled in Attributes inspector: Then disappear keyboard when scrollView is tapped: Drag a Tap Gesture Recognizer onto your scrollView. viewDidLoad() // Subscribe to Keyboard Will Show notifications NotificationCenter. Jun 21, 2023 · 1. tableView. You use text fields to gather text-based input from the user using the onscreen keyboard. Oct 18, 2021 · Unfortunately on iOS 15, this forces the keyboard to only allow ASCII-compatible characters, so it will hide Emoji and UTF-8 keyboards (like Russian), so it's a fix with compromises. never if you want the keyboard to remain present during scrolling. self. You can extend other notification by implement other enum value; It's useful when you have to deal with keyboard in several controllers Mar 27, 2018 · Then somewhere (probably viewDidLoad), you add the line - myTextField. cgRectValue. In order to implement the inputAccessoryView simply add this method (or a variation thereof) and call it in viewDidLoad. struct TextBox: View {. @FocusState for iOS 15+ The above method requires you to directly interact with the UIApplication method. Dec 29, 2020 · Seems pretty straight forward, so I've stuck with it. cancelsTouchesInView = false view. resignFirstResponder() to hide the keyboard again. resignFirstResponder() return true. endEditing)) view. There answers above are correct. . Also you can manage scroll in same method based on keyboard size. Updated Answer :: You can set constraints to bottom of view contains textfield and update it on keyboard show\hide. searchActive = false; searchProject. resignFirstResponder() and self. I can achieve this with . Date. requestFocus()'. Jun 12, 2014 · Click on a text field and then select from the right hand side utilities panel 'Show the Connection Inspector' tab. I have used the below code to add TextField on the screen. scrollDismissesKeyboard(. This code help you to hide keyboard on touch anywhere on viewcontrol. youtube. Toolbar is home to all your favorite Microsoft SwiftKey features and useful settings. You just require a basic knowledge in both languages. You use this modifier to customize how scrollable content interacts with the software keyboard. Click the UITextField UI component in the Main. //Create a done button with an action to trigger our function to dismiss the keyboard. Adding padding to the view. addGestureRecognizer(tap) @objc func Jul 2, 2019 · I have a view with a embedded tableview in it in which i have a UITextField and I want to hide the keyboard when I press the done button My Code is the following: My tableViewController: Mar 11, 2015 · What I want is for the DatePicker to show up on the first try. Mar 25, 2022 · I am trying to create a messaging page layout but the keyboard hides the textfield and moves everything to the the top. That is easy to solve while dismiss the keyboard from its own action handler. endEditing(true) accomplish the same task - hiding the keyboard from the user's view and de-focusing whatever text field was using it. They are Keyboard Type, Keyboard Look, and Return Key. Jun 7, 2019 · This removes the Text view from the hierarchy when showText equals false. In the following example we can see how activating the TextField compresses the colors heights: @State Sep 12, 2013 · 289. Welcome back to a new episode of MasteringProgramming, in this episode I will be showing you how to dismiss the KeyBoard from the screen in swift. The correct way to handle this is to add a done button in an inputAccessoryView to the UITextView. let doneBtn = UIBarButtonItem(title: "Done", style: . Nov 26, 2018 · 1. Here is an example that can help you out. Nov 23, 2018 · A simple function is used to hide the keyboard, and we can use the function any where by using “self. Jan 4, 2022 · 2. viewDidLoad() // show keyboard textView. 13. To hide the keyboard when scrolling the TableView and stop editing properly, we still need to combine two types of answers: Set the keyboard dismiss mode in IB (as Kyle explained) or in ViewDidLoad() code (as Pei explained) for instance: tableView. June 21, 2023. Text fields use the target-action mechanism and a delegate object to report changes made during the course of editing. com Oct 9, 2023 · Learn how to programmatically dismiss a keyboard in SwiftUI. This assumes that the text view is editable. The keyboard is configurable for many different types of input such as plain text, emails, numbers, and so on. Feb 22, 2020 · Tap on the modified View will dismiss the keyboard, but only if editingFlag == true. Microsoft SwiftKey is the intelligent keyboard that learns your writing style, so you can type faster. notificationCenter. Create an object of touch gesture and add an action method that causes the view to resign from the status of first responder: let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(DismissKeyboard)) view. kr hc mj uc ft ms kw ki mq dg