I have put 4 buttons with 4 labels on the button as button title using interface builder. My button label shows the showroom name, email id…etc with font size 17 correct. But if Showroom name or email id get bigger then my button label shows information with small font size which looks odd and not according to apple HIG.
So can we increase button height programmatically to show button label title with consistent font size 17.
I have put 4 buttons with 4 labels on the button as button title
Share
you can use ‘sizeToFit’ function to RESIZE button to it’s content optimum display,
or
you can use ‘sizeThatFits:CGSizeZero’ to actually GET the optimum frame and do whatever you want with it.
OBS: this will only work if ‘sizeThatFits’ is bigger that original size, so i suggest you to set size to something like (1,1) before calling the functions above