iPhone: How do I add layers to UIView's root layer to display an image with the content property?

前端 未结 3 1222
盖世英雄少女心
盖世英雄少女心 2021-02-06 11:03

According to the Mac Dev Center docs, you should be able to set the contents property of a CALayer and have that render automatically. However, I still can\'t get a simple image

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 11:34

    You don't need to set the contentsRect (and if you do, it should be in the unit coordinate space, probably just CGRectMake(0, 0, 1.0, 1.0).

    You might want to set the layer's position property.

提交回复
热议问题