Wednesday, 15 January 2014

ios - How to recognize the movement of the UISlider is from maximum to its minimum value and its Vice Versa? -



ios - How to recognize the movement of the UISlider is from maximum to its minimum value and its Vice Versa? -

i want know how identify uislider tracking towards maximum minimum values? ex, slider maximum , minimum values 1.0 , 0.0. how can identify slider tracking 0.0 1.0 , vice versa?

thanks!

.h

to track lastly value

@property(nonatomic,assign) float lastvalue;

.m

in viewdidload hear uicontroleventvaluechanged

[yourslider addtarget:self action:@selector(myslidervaluechanged:) forcontrolevents:uicontroleventvaluechanged];

define method

- (ibaction)myslidervaluechanged:(uislider *)sender { float currentvalue = sender.value; if (currentvalue>self.lastvalue) { nslog(@"moving right"); } else{ nslog(@"moving left"); } self.lastvalue = sender.value; }

ios iphone objective-c uislider

No comments:

Post a Comment