开发者

How to implement image animation via an invisible UIslider?

开发者 https://www.devze.com 2023-02-27 01:53 出处:网络
I got a question is using UISlider to control a image animation And this image has invisible slider to cover on it ...

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

How to implement image animation via an invisible UIslider?

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 ~

0

精彩评论

暂无评论...
验证码 换一张
取 消