SwiftUI .rotationEffect() framing and offsetting

后端 未结 2 717
盖世英雄少女心
盖世英雄少女心 2021-02-13 16:26

When applying .rotationEffect() to a Text, it rotates the text as expected, but its frame remains unchanged. This becomes an issue when stacking rotated views with non-rotated v

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-13 16:29

    RotationEffect takes a second argument which is the anchor point, if you omit it - the default is .center.

    Try this instead:

    .rotationEffect(.degrees(-90), anchor: .bottomTrailing)
    

提交回复
热议问题