FInd contenView width in UITableViewCell in case of iPad

In iPAD, when you create a new UITableViewCell, the width of the contentView is set to 320. Is there a way to get the desired width? I cannot use the width of the current view, since the table cells do not cover the entire width of the view. Any help would be greatly appreciated.

+7
width uitableview ipad
source share
2 answers
- (void)layoutSubviews { [super layoutSubviews]; CGFloat viewWidth = self.contentView.frame.size.width; 

This gives the correct width for the contentView . If [super layoutSubviews] not called initially, then the contentView frame contentView set incorrectly.

+3
source share

I solved this problem 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); 
+5
source share

All Articles