I'm a little confused this question.
I know that I can move views changing their self.frame.origin
, but I found that there is a property called transform and I thought that this is for moving my view on the screen and etc.
Maybe I don't understand that a little.
So I want to know: which property I must use for moving UIView
(or it's subclasses) and for what is another one?
Or if I'm completely wrong show me the right way please.
The frame
property of a UIView
defines it's position relative to it's superview. If you want to move a view, that's the way to go.
The transform
property basically applies a CGAffineTransform
to the backing layer of the view. In most cases you don't want to use this property if you just want to move the view.
The transform
property is useful when it comes to rotating or scaling the layer (i.e. view). Sometimes, when you apply a rotation, you also need to move it to make it "keep" it's postion, in that case you would use the transform
property to move it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With