ios - Setting up UISlider -


i've setup uislider accept values 0 10. want able have slider execute static commands each increment of uislider value, 0 10. i've linked uislider button called zoomcontrol. example, want this:

- (ibaction)zoomcontrol {     if(zoom.selectedsegmentindex == 0)     {         // execute commands     }      else if(zoom.selectedsegmentindex == 1)     {         // execute commands     }      else if(zoom.selectedsegmentindex == 2)     {         // execute commands     }  // + remaining statements 10 } 

this declaration of uislider, made in .h file, button:

@interface viewcontroller : uiviewcontroller  {     iboutlet uislider *zoom; }  - (ibaction)zoomcontrol; 

the errors i'm experiencing have selectedsegmentindex block. correct syntax uislider?

(the selectedsegmentindex block syntax uisegmentedcontrol switch)

you using property of uisegmentedcontrol named selectedsegmentindex, need access value property of uislider.

use instead zoom.value

try

if ((int)(zoom.value + 0.5) == 0) { //do something...} 

i've added 0.5 round value when type casting int because zoom.value of type float.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -