How can I increase the size of a CGRect by a certain percent value?

后端 未结 7 2035
春和景丽
春和景丽 2021-02-12 14:22

How can I increase the size of a CGRect by a certain percent value? Should I use some form of CGRectInset to do it?

Example:

Assume I have a CGRect:

7条回答
  •  佛祖请我去吃肉
    2021-02-12 14:44

    Sure, using CGRectInset works:

    CGRect someRect = CGRectMake(10, 10, 100, 100);
    someRect = CGRectInset(someRect, someRect.size.width * -0.2, someRect.size.height * -0.2);
    

提交回复
热议问题