I have a view containing several subviews. I can detect and let the user rotate just one subview or the containing view using UIRotationGestureRecognizer. But I would like to be able to rotate any square collection of subviews, like so:
Initial state:
Rotating upper right square counter-clockwise
To get here
How can I achieve this behavior? How should I nest my view hierarchy?
Any pointers are appreciated :)
here's what I would do (pseudocode):
when rotation recognized:
create new_layer
new_layer.bounds = union_rect( frames of tiles to be rotated )
new_layer addSublayers:(tiles to be rotated)
while rotation in progress:
new_layer.transform = CATransform3DMakeRotation( angle, 0, 0, 1 )
when rotation complete:
(original view).layer addSublayers:(tiles to be rotated)
(tiles to be rotated) rearrange after rotation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.