I'm useing storyboard with a swift project. I have a UIImageView I've declared and linked as an IBOutlet like so:
@IBOutlet var testImageView: UIImageView?I am trying to change the imageview's position programmatically by using two methods: changing the imageview's .center value and the frame.origin value.
I can change all other properties of the imageview such as background color, or image, however moving the center/origin values will not work. Weird thing is I print to the log it's initial position and then once again after I've modified it's center point and it gives a different value to the log... But the imageview itself is still in the exact same position as it started.
I added the UIImageView to the storyboard manually connected everything properly (changing background color/image works fine).
I'm using the latest version of swift + xcode that I updated 2 days ago.
If you have auto layout enabled (as it is by default), then you can't move things around by changing the frame or center properties. Auto layout will reposition them based on the layout constraints. Make outlets for the constraints that position the view, and change the "constant" property when you want to move your view. Or, set up some constraints in IB, mark them as "placeholder" so they're removed at build time, and add your own constraints in code.