Although you can directly print a CGRect
using NSStringFromCGRect
, here is a sample of what you are looking for. I'm just putting button1's coordinates in text field.
UIButton *button1, *button2, *button3, *button4;
CGFloat button1X = button1.frame.origin.x;
CGFloat button1Y = button1.frame.origin.y;
CGFloat button2X = button2.frame.origin.x;
CGFloat button2Y = button2.frame.origin.y;
CGFloat button3X = button3.frame.origin.x;
CGFloat button3Y = button3.frame.origin.y;
CGFloat button4X = button4.frame.origin.x;
CGFloat button4Y = button4.frame.origin.y;
NSString *button1Coords = [NSString stringWithFormat:@"x = \"%f\" x = \"%f\"", button1X, button1Y];
self.textField.text = button1Coords;