控制系统音量,自定义MPVolumeView(二)

2015-07-24 05:54:35 · 作者: · 浏览: 15
nge { [[MPMusicPlayerController applicationMusicPlayer] setVolume:self.volumeSlider.value]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ for(UITouch *touch in event.allTouches) { self.firstPoint = [touch locationInView:self.view]; } UISlider *slider = (UISlider *)[self.view viewWithTag:1000]; slider.value = self.slider.value; NSLog(@"touchesBegan"); } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ for(UITouch *touch in event.allTouches) { self.secondPoint = [touch locationInView:self.view]; } NSLog(@"firstPoint==%f || secondPoint===%f",self.firstPoint.y,self.secondPoint.y); NSLog(@"first-second==%f",self.firstPoint.y - self.secondPoint.y); self.slider.value += (self.firstPoint.y - self.secondPoint.y)/500.0; UISlider *slider = (UISlider *)[self.view viewWithTag:1000]; slider.value = self.slider.value; NSLog(@"value == %f",self.slider.value); self.firstPoint = self.secondPoint; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"touchesEnded"); self.firstPoint = self.secondPoint = CGPointZero; }


源码下载:http://download.csdn.net/detail/woshiwls/7548545