Reputation: 1973
I need get the position of the origin center of a UIButton
for example
this give the size of the UIButton
NSLog(@"%f",button.frame.origin.x);
NSLog(@"%f",button.frame.origin.y);
How get the center of origin frame of the UIButton?? any help is appreciated
Upvotes: 4
Views: 3433
Reputation: 4272
NSLog(@"%f",button.frame.origin.x);
NSLog(@"%f",button.frame.origin.y);
No, this will not give you the size, it will give you the x and y position of your button, the button size is:
NSLog(@"%f",button.frame.size.width);
NSLog(@"%f",button.frame.size.height);
and you can get the center of your button like:
CGPoint center = [button center];
Upvotes: 2