简体   繁体   中英

how do i make the numbered keyboard come up when user taps on a UITextField swift 5 iOS13

@IBOutlet weak var billTextField: UITextField!

how would i make this so when a user taps on the textfield, that the number keyboard appears on screen so the user can type a number / Float type number.

ie tip calculator.

first got to your storyBoard and then click on your textfield and then go to show the attributes inspector and then change your keyboard in keyboard type you can see in below image选择键盘类型

and you can also do with code:-

    self.your text name.keyboardType = UIKeyboardType.numberPad

You can use third-party libraries for this available on GitHub. Like, NumericKeyboard or NumberKeyboard. Sharing link below:-

https://github.com/marcjordant/NumericKeyboard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM