FInd the width of contenView in a UITableViewCell in case of iPad
On iPAD when you create new UITableViewCell the contentView width set for 320. Is there a way to get the right width? I c开发者_开发知识库an'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.
精彩评论