I have a button on a view, I want to add another button next to it when the first button is touched.
Therefore I need it’s top left corner to do the math.
Here’s what is puzzling me greatly:
// this code is executed when the button is pressed
NSLog(@”X:%f”,moreButton.frame.origin.x);
that returns on the first and second click the followings:
2010-04-24 22:58:25.883 iPad PopOver[8095:40b] X:-1.999002
2010-04-24 22:58:25.884 iPad PopOver[8095:40b] Y:0.000000
why and how can I get the x,y of an existing button on the view? (button created via IB)
Thanks!
mE
ps: I have looked at similar posts and my code looks fine but I keep getting zeros (it’s an ipad app if matters in any way)
Try the following and see if this changes things, your code strictly should work, but I usually use an integer formatter.
Once you’ve cracked that, you also have the following methods you can perform on the button that you may find useful