In iphone 6, I am making a custom UITableViewCell. In init function when I do,
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
And then , I check the frame it comes out to be 320 X 44
instead of 375 X 44
. However, in layoutSubviews
, it comes fine. I am checking this on iphone 6 simulator. Is there a way I can get the correct size in init only ?
You will find the width with the tableview size and it's 44px on height by default, so you can override initWithStyle method and add tableview width parameter.
I suppose you can't. Same issue has been following the iPad for the last few years, and I don't believe anything has changed now. New cell always has 320 px width at first. You can implement some custom logic, such as laying out subviews not depending on current bounds, but on desired future bounds.
But anyway, if you're adapting the interface to iPhone 6 & 6 Plus, you obviously also support iPhone 5, which has width 320px. Then just create "resizable" cell that looks good with any cell width.
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