开发者

iOS UITextField formatted for time

开发者 https://www.devze.com 2023-03-13 19:40 出处:网络
I have a UITextField which I created programmatically. This text field is used to input a time. The placeholder text is \"00:00:00.000\". When the text field is tapped, a number pad will appear. Ideal

I have a UITextField which I created programmatically. This text field is used to input a time. The placeholder text is "00:00:00.000". When the text field is tapped, a number pad will appear. Ideally, I want the gray place holder text to remain as the user types. As they enter a number, it replaces t开发者_StackOverflow社区he gray zeros in the place holder text and skips over the colons and period (leaving the format intact without the user entering any punctuation). If it is not possible to keep the place holder text and replace it as the user types, I would like the punctuation to automatically be entered.

Thanks in advance!


iOS has a UIDatePicker control for this, if you want to go the way you are going then you will have handle all the user input your self.

0

精彩评论

暂无评论...
验证码 换一张
取 消