View.center not the center?
I am working with the UI module, and I came across an issue where view.center wasn't giving me the center of the view. Some created my own function for getting the center of the view as a tuple.
They return different values.
center = (frame.width/2,frame.height/2)
My function made the UI control go to the center.
Any ideas what is happening?
centerdoesn't tell you where the center of your view is in its own coords, it tells you the center in the containing views coords, just like
y. If your view's x and y attributes happen to be 0, then you'll get the same answer (assuming you have not used transform to rotate the view, or are doing funny things with bounds)
So, you use
centerfor positioning a view, not for positioning its subviews.