SpillYerLungs
SpillYerLungs

Reputation: 113

Setting UITextField's textContentType to creditCardNumber overrides keyboardType setting?

I am setting my text field's content type and keyboard type as follows:

numberTextField.textContentType = .creditCardNumber
numberTextField.keyboardType = .numberPad

However, the resulting keyboard is the default QWERTY keyboard. The number pad keyboard only shows up when I remove the textContentType setting.

This happens both when I set these attributes programmatically and in the interface builder.

Is this a bug or am I missing something?

Upvotes: 6

Views: 1207

Answers (2)

Vadim Yelagin
Vadim Yelagin

Reputation: 3262

The keyboard type for a creditCardNumber field changes if you set returnKeyType.

Upvotes: 4

Barış Arslan
Barış Arslan

Reputation: 11

Is that what you're talking about? If so, either the two or just the one, the numeric keypad always opens.

enter image description here

Upvotes: 1

Related Questions