Questions tagged [uikeyboard]

uikeyboard is an iOS object used to represent a keyboard. Implementors use it to create an interface which approximates a physical keyboard

1026 questions
1733
votes
95 answers

How can I make a UITextField move up when the keyboard is present - on starting to edit?

With the iOS SDK: I have a UIView with UITextFields that bring up a keyboard. I need it to be able to: Allow scrolling of the contents of the UIScrollView to see the other text fields once the keyboard is brought up Automatically "jump" (by…
philfreo
  • 36,787
  • 25
  • 119
  • 140
442
votes
39 answers

Close iOS Keyboard by touching anywhere using Swift

I have been looking all over for this but I can't seem to find it. I know how to dismiss the keyboard using Objective-C but I have no idea how to do that using Swift? Does anyone know?
lagoon
  • 5,747
  • 6
  • 19
  • 28
314
votes
42 answers

Move view with keyboard using Swift

I have an app that has a text field on the lower half of the view. This means that when I go to type in the text field the keyboard covers the textfield. How would I go about moving the view upwards while typing so I can see what i'm typing and then…
Alex Catchpole
  • 6,546
  • 6
  • 18
  • 28
185
votes
22 answers

How do you dismiss the keyboard when editing a UITextField

I know that I need to tell my UITextField to resign first responder when I want to dismis the keyboard, but I'm not sure how to know when the user has pressed the "Done" key on the keyboard. Is there a notification I can watch for?
kubi
  • 44,308
  • 19
  • 90
  • 118
177
votes
12 answers

Programmatically change UITextField Keyboard type

Is it possible to programmatically change the keyboard type of a uitextfield so that something like this would be possible: if(user is prompted for numeric input only) [textField setKeyboardType: @"Number Pad"]; if(user is prompted for…
eric.mitchell
  • 8,501
  • 12
  • 50
  • 91
124
votes
11 answers

How to get height of Keyboard?

The height of a keyboard on varying iOS devices is different. Does anybody know how I can get height of a device's keyboard programmatically?
Lachtan
  • 3,793
  • 6
  • 18
  • 28
108
votes
14 answers

How to make return key on iPhone make keyboard disappear?

I have two UITextFields (e.g. username and password) but I cannot get rid of the keyboard when pressing the return key on the keyboard. How can I do this?
K.Honda
  • 3,068
  • 5
  • 24
  • 36
106
votes
29 answers

Dismiss keyboard by touching background of UITableView

I have a UITableView with UITextFields as cells. I would like to dismiss the keyboard when the background of the UITableView is touched. I'm trying to do this by creating a UIButton the size of the UITableView and placing it behind the…
Hua-Ying
  • 3,166
  • 4
  • 21
  • 25
84
votes
15 answers

Allow only Numbers for UITextField input

The iPad does not have a "Numpad" keyboard like the iPhone/iPod does. I'm looking to find how I can restrict the user's keyboard to only accept values 0 through 9. I would imagine using UITextField's "shouldChangeCharactersInRange" but I don't know…
Demasterpl
  • 2,037
  • 4
  • 24
  • 32
83
votes
12 answers

Getting keyboard size from userInfo in Swift

I have been trying to add some code to move my view up when the keyboard appears, however, I am having issues trying to translate the Objective-C examples into Swift. I have made some progress, but I am stuck on one particular line. These are the…
user3746428
  • 10,497
  • 19
  • 72
  • 129
77
votes
15 answers

UI Test deleting text in text field

In my test I have a text field with a pre-existing text. I want to delete the content and type a new string. let textField = app.textFields textField.tap() // delete "Old value" textField.typeText("New value") When deleting string with hardware…
Tomasz Bąk
  • 5,764
  • 3
  • 31
  • 46
69
votes
2 answers

HW kbd Failed to set (null) as keyboard focus ios

In my iOS app crash log I found this statement: HW kbd Failed to set (null) as keyboard focus ios Does anyone know what this is and how to resolve it?
Waris Shams
  • 1,566
  • 1
  • 14
  • 26
62
votes
3 answers

Change text of "Return" keyboard button

How can I change the standard text of the "Return" button to something else? I want it to be "Add".
Ilya Suzdalnitski
  • 49,863
  • 47
  • 128
  • 166
62
votes
19 answers

How to dismiss keyboard when touching anywhere outside UITextField (in swift)?

I'm working on a project that have a UIViewController, on the view controller there is a UIScrollView and a UITextField on the scrollview. like this: I'm trying to dismiss the keyboard and hide it after typing some text in the textfield and tap…
White Hat
  • 661
  • 1
  • 6
  • 15
57
votes
5 answers

dismiss keyboard with a uiTextView

I am sure this is not that difficult, but I am having trouble finding info on how to dismiss a keyboard with the return/done key using a textview, not a textfield. here is what I have tried so far(which works with a textfield.) Thanks very much in…
user3708224
  • 1,129
  • 3
  • 17
  • 36
1
2 3
68 69