2010-10-20 67 views

回答

3
- (void)layoutSubviews { 
    [super layoutSubviews]; 
    CGFloat viewWidth = self.contentView.frame.size.width; 

这给出了contentView的正确宽度。如果最初没有调用[super layoutSubviews],则contentView帧设置不正确。

+0

想必这是一个自定义的tableview细胞。 – 2013-10-09 16:04:47

5

我已经解决使用这个问题:

cell.contentView.frame = CGRectMake(cell.contentView.frame.origin.x, 
             cell.contentView.frame.origin.y, 
             self.tableView.frame.size.width, 
             cell.contentView.frame.size.height); 
相关问题