Keep text on an image readable while rotating the image

前端 未结 1 1795
遥遥无期
遥遥无期 2021-01-22 15:12

I have an image view that looks like a wheel. This view detects touch events on each of the colored sections.

The problem I have is that when I rotate this wheel, the

相关标签:
1条回答
  • 2021-01-22 15:53

    Presumably you are applying a rotation transform to rotate the wheel. If the labels are subviews of the wheel view, their centers are pinned in the right places to the wheel (because a view is located in its superview by its center), and they will travel around with it. At the same time, apply the inverse rotation transform to the labels. The rotation takes place around the center of each label. So each label stays in the right place and stays upright.

    An afterthought - also make sure you're not using autolayout on these labels. Autolayout breaks view transforms.

    0 讨论(0)
提交回复
热议问题