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:
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 :)
The problem I had was the constraints set up in Storyboard were overriding the frame change. This explains why I wasn't having the same issues with programmatically added objects. All I had to do to turn off constraints for the project was to go to the Storyboard.storyboard
file, then make sure the "Utilities" sidebar is open and select the "File Inspector" tab. Then I scrolled down under "Interface Builder Document" and deselected "Use Autolayout." After this, I reran the the project to find setting the frame programmatically did work.