0

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.

Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121
Ali Hassan
  • 519
  • 6
  • 26
  • 2
    This is not well suited to touch, the general rule-of-thumb is a minimum touch size of 44 X 44 points.Reliably touching the buttons in the image shown would be rather hit-and-miss at best. That is why such a control is not included in the set of controls provided by Apple. – zaph Dec 26 '13 at 13:30
  • Agree with Zaph. And I guess the image you have provided was made by a human that has nothing in common with designing IOS apps, otherwise he would make two separate buttons at least 30x30pt, OR an alternative input method. – John Smith Dec 26 '13 at 13:36

1 Answers1

1

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

ipraba
  • 16,485
  • 4
  • 59
  • 58
  • 1
    Actually there (sort of) is: [UIStepper](https://developer.apple.com/library/ios/documentation/uikit/reference/UIStepper_Class/Reference/Reference.html) (iOS 5.0+) has the buttons size-by-side. Of course, if there's a text field it might make sense to have the buttons on either side. – tc. Dec 26 '13 at 13:44
  • Oh yes that one is there. I almost forgot that one. Anyhow Ali has to tweak something to achieve his control. Again @tc thanks for nothing that. good catch ;) – ipraba Dec 26 '13 at 13:51