Search code examples
iosobjective-cuibuttoncoordinatesuiscreen

How to get button x,y coordinate in a textfield


I have 4 different buttons for every corner of the screen. Just need to show their coordinates for every device changes in a text field or a label.

“x0” - button x coordinate on the screen “y0” - button y coordinate on the screen

i should show like x = "x0" ; y = "y0"


Solution

  • There is an easy built-in way to log frames. Use NSStringFromCGRect(frame); to show the coordinates of the button.