How to create an image from UILabel?

前端 未结 6 1812
情深已故
情深已故 2020-12-01 07:55

I\'m currently developing a simple photoshop like application on iphone. When I want to flatten my layers, the labels are at the good position but with a bad font size. Here

6条回答
  •  不思量自难忘°
    2020-12-01 08:34

    You can use renderInContext on any CALayer. It will draw your view's layer on the context. So that you can change it to an image. Also if you do renderInContext on a view , all its subviews will be drawn onto the context. So instead of iterating through all the labels, while adding the labels, you can add those to a containerView. And just need to do renderInContext on that containerView.

提交回复
热议问题