objective c - How to get UISlider thumb position -


how know uislider thumb position?
when press button want add flag on current slider thumb position.
how can acquire current thumb position can add flag?

this synchronization code:

 _positionslider.value = _mediaplayer.position; 

this how slider should like:

look image

try this, first create uiimageview

@interface viewcontroller () {     uiimageview *imageview; } 

and write below code in viewdiload() function

imageview = [[uiimageview alloc]initwithframe:cgrectmake(self.slider.frame.origin.x, self.slider.frame.origin.y-20, 20, 10)]; imageview.image = [uiimage imagenamed:@"navigateimage.png"]; [self.view addsubview:imageview];  [self.slider addtarget:self action:@selector(slidervaluechanged:) forcontrolevents:uicontroleventvaluechanged]; 

and add slider event function

-(void)slidervaluechanged:(uislider *)slider{      cgrect trackrect = [self.slider trackrectforbounds:self.slider.bounds];     cgrect thumbrect = [self.slider thumbrectforbounds:self.slider.bounds                                              trackrect:trackrect                                                  value:self.slider.value];      cgrect r = [imageview frame];     r.origin.x = thumbrect.origin.x;     [imageview setframe:r];      nslog(@"%f",thumbrect.origin.x);  } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -