Reputation: 2001
Because my frames are in stackviews, my UI elements are returning their frame in the superview coordinate system (that is, the stackview)
I want to return them in the self.view coordinate space.
Ho
print ("untf frame",self.view.convert(usernameTextField.frame, to: self.view ) )
print ("pwtf frame",self.view.convert(passwordTextField.frame, to: self.view ) )
both return the same values.
Of course I can see that passwordTextField is 50 down from username.
What am I doing wrong?
Upvotes: 0
Views: 387
Reputation: 16466
It is wrong
print ("untf frame",self.view.convert(usernameTextField.frame, to: self.view ) )
print ("pwtf frame",self.view.convert(passwordTextField.frame, to: self.view ) )
Your usernameTextField
and passwordTextField
is subview of stackview so you need to convert it to self.view
Use like this
print ("untf frame",self.stackview.convert(usernameTextField.frame, to: self.view ) )
print ("pwtf frame",self.stackview.convert(passwordTextField.frame, to: self.view ) )
Upvotes: 1