On iPAD when you create new UITableViewCell the contentView width set for 320. Is there a way to get the right width? I can't use the width of the current view as the table cells do not span the entire width of the view. Any help would be greatly appreciated.
I've solved this issue using:
cell.contentView.frame = CGRectMake(cell.contentView.frame.origin.x,
cell.contentView.frame.origin.y,
self.tableView.frame.size.width,
cell.contentView.frame.size.height);
- (void)layoutSubviews {
[super layoutSubviews];
CGFloat viewWidth = self.contentView.frame.size.width;
This gives the right width for contentView
. If [super layoutSubviews]
is not called initially then the contentView
frame is not set correctly.
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