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
CGPoint centerPoint = [button center];
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With