I got a question is using UISlider to control a image animation
And this image has invisible slider to cover on it ...
It looks like this
My question is ... how to adjust image angle ,when I开发者_C百科 change my slide value ???
So that's I can let the image animation from left pic to right pic ???
Thanks
Webber
upload the sample code Here
Hope someone can help me to figure out this problem
Do you want to rotate the image? Then use:
imageView.transform = GAffineTransformRotate(imageView.transform,RADIANS(degreesToRotate));
- (IBAction)changeSliderValue:(id)sender{
int progressAsInt =(int)(invisibleSlider.value);
if (progressAsInt==0) {
[dimmerImg setImage:[UIImage imageNamed:@"slider0.png"]];
}
else {
[dimmerImg setImage:[UIImage imageNamed:@"slider99.png"]];
CGAffineTransform transform = CGAffineTransformIdentity;
dimmerImg.transform = CGAffineTransformRotate(transform, progressAsInt * M_PI / 180);
//dimmerImg.transform = CGAffineTransformRotate(dimmerImg.transform, progressAsInt);
}
}
This works fine ~
精彩评论