ReasyEasyPeasy ReasyEasyPeasy - 4 months ago 52
Swift Question

change local coordinates of an object(swift3)

I draw a custom UIbutton. Now I want, that the 0,0-point is in the middle of the object. Not on top-left-corner. So If I set the position of this button in a view to the middle point of the view, the button is really in the middle and I dont have to add the half of the width and the half of the height.


If I set the position of the object to the middle of a view it should look this:
right position
and not like this:
false position


You're modifying the origin of the frame, each view has a property center which does exactly what you want.