How to “rotate” a layer/view (e.g. just like you would in enigmo)

前端 未结 4 1294
栀梦
栀梦 2021-02-04 11:54

I know how to move a layer based on touch. But I would also like to be able to rotate the image.

Is there any sample code that shows how to do this? Or can anyone give

4条回答
  •  萌比男神i
    2021-02-04 12:26

    I ended up doing it like this:

    CGAffineTransform transform = CGAffineTransformMakeRotation(angle);
    [[self viewWithTag:999] setTransform:transform];
    

    Note that the angle is in radians.

提交回复
热议问题