How do I create a CGRect from a CGPoint and CGSize?

后端 未结 4 445
攒了一身酷
攒了一身酷 2021-02-01 01:22

I need to create a frame for a UIImageView from a varying collection of CGSize and CGPoint, both values will always be different depending

4条回答
  •  庸人自扰
    2021-02-01 02:00

    Building on the most excellent answer from @Jim, one can also construct a CGPoint and a CGSize using this method. So these are also valid ways to make a CGRect:

    CGRect aRect = { {aPoint.x, aPoint.y}, aSize };
    CGrect aRect = { aPoint, {aSize.width, aSize.height} };
    CGRect aRect = { {aPoint.x, aPoint.y}, {aSize.width, aSize.height} };
    

提交回复
热议问题