I have a button, created in storyboard and linked in my .h using
@property (strong, nonatomic) IBOutlet UIButton *gridLabel;
I'm trying to find out how big it is inside the viewDidLoad of my .m. For this I use
_gridLabel.bounds.size.width
But this always gives out a fixed number, no matter how big the button actually is. How can I make it work?
I am also getting the size of the screen using
[[UIScreen mainScreen] bounds].size.width
and this seems to work. So can I do something similar
[[something _gridLabel] bounds].size.width
If so, what is the something?
rmaddy
320k44 gold badges548 silver badges591 bronze badges
asked Jan 11, 2016 at 13:39
quantum_jim
2182 silver badges11 bronze badges
lang-objectivec
viewDidLoadthere is no correct bounds. TryviewWillAppearorviewDidLayoutSubviews