How to position a UIView?

前端 未结 2 1656
予麋鹿
予麋鹿 2021-02-08 11:19

I spent a couple of hours trying to position a UIView and eventually figured out that I needed to modify the views frame. So I added a \'setPosition\' method to the UIViewContro

2条回答
  •  走了就别回头了
    2021-02-08 11:58

    Other way:

    CGPoint position = CGPointMake(100,30);
    [self setFrame:(CGRect){.origin = position,.size = self.frame.size}];
    

    This i save size parameters and change origin only.

提交回复
热议问题