首页 > 解决方案 > Swift UI - 旋转后提高文本质量?

问题描述

在 Text() 视图上使用 .rotationEffect 后,它实际上使文本看起来不那么清晰和模糊。我认为这是因为它被光栅化了,但是我想知道是否有办法解决这个问题,或者在文本经历旋转效果后提高文本质量的方法?

ZStack{
             Image("tile_empty")
              .resizable()
              .aspectRatio(contentMode: .fit)
              .frame(minWidth: 0, maxWidth: 250, minHeight: 0, maxHeight: 250)
              .rotationEffect(.degrees(120.0 * Double(i) + 30))

             Text("\(self.globals.levels[self.globals.currentLevel].tiles[self.tilesIndex].subTiles[i].word)")
               .font(Font.custom("Prime", size: ScreenSize.screenWidth * 0.04))
               .foregroundColor(.init(hex: "F2E9E4"))
               .fontWeight(.semibold)
               .rotationEffect(.degrees(-120.0 * Double(i) + -30))<----- Causes blurry text
                         
}

标签: iostextswiftuirasterizing

解决方案


推荐阅读