Simulate a numeric stepper (up / down control)

Stacey Rogers shared this question 4 years ago
Answered

Anyone created a prototype which has a numeric stepper in it?


i.e. the '- / +' or 'down/ up' control which increases and decreases the value shown on a label


The stepper in the iOS7 library seems to just be an image which does nothing on simulate

Comments (3)

photo
1

Ive figured this one out for myself if anyone else is looking for a solution ...


I created two buttons '-' and '+' then created a label_1 which is hidden with a value of '1'


For each of the entries I also created a label_2 starting at zero so the line looks like this:


- 0 +


Then created a rule on the minus which is:


On Tap


Label_2 is calculated


Label_2 - Label_1


Then created a rule on the add which is:


On Tap


Label_2 is calculated


Label_2 + Label_1


This seems to work and you only have to create the hidden '1' once


If you don't want negative values you could also set the rule on the minus button which is 'if label_2 or something along those lines ........

photo
1

Hi there,


I am trying to do the same thing.


What do you mean 'is calculated' ? Can you please specify each step into: Name > Action > Value? And also what you have done in the conditions ui?

photo
1

Hi Sam,


You should follow this steps:


1. Create an event into the minus icon --> On click - Set Value / Click into Calculated and set the following expressión : (Input text field value - 1 ) In case you want that the minimum value is 0 you will need to set a condition that the input value to be > 0.


2.Create an event into de plus icon --> On click - Set Value / Click into Calculated and set the following expression: Input text field + 1.


Kindly let me know how it goes.


Best,


Sonia Durán