TextField With increment and decrement button

1.5k Views Asked by At

enter image description here

I have to use a textfield which gets number as input along with two buttons to increment and decrement the number.

Is there something like this as shown in image?

I am thinking of using textfield with two buttons. But it will be not be good as I think.

1

There are 1 best solutions below

2
On

There is no control like that by default in iOS.

Option1: You have to create a component of yourself like what you have said. Create a component as AHPickerView(Ali Hassan PickerView)and you can give to the public(A UIView with a textfield and two buttons ) ;)

Option2: If you can sacrifice the UI then you can replicate the same functionality using UIPicker with two columns.

I prefer the second is option is good.

Note: Usability-wise option1 will be very hard for the user(Will almost irritate the user) to touch the increment and decrement button since it will be very small to touch exactly.

EDIT: AS @tc noted in comment, you may want to check this control UIStepper and its appearance here