Container View made in Storyboard will not change frame programmatically

前端 未结 2 1127
暗喜
暗喜 2021-02-10 22:17

I have a container view, @property (weak, nonatomic) IBOutlet UIView *containerView;, but it won\'t move when I set its frame. Here is how I am trying:



        
2条回答
  •  执念已碎
    2021-02-10 22:51

    The "frame" property of a view is used for layout. If you have layout your container view in the storyboard and wanna move it in code. Try the "transform" property. Such as, "self.containerView.transform = CGAffineTransformTranslate(self.containerView.transform, 0.0, 10.0);" => move up the container view for 10 points :)

提交回复
热议问题