Tag: 可用视图

如何以分组样式设置UITableView中单元格的宽度

我已经为此工作了大约2天,所以我想我与你分享我的学习。 问题是:是否有可能使分组的UITableView单元格的宽度更小? 答案是不。 但是有两种方法可以解决这个问题。 解决scheme#1:一个更薄的表可以改变tableView的框架,以便表更小。 这将导致UITableView呈现宽度减小的单元格。 对此的解决scheme可能如下所示: -(void)viewWillAppear:(BOOL)animated { CGFloat tableBorderLeft = 20; CGFloat tableBorderRight = 20; CGRect tableRect = self.view.frame; tableRect.origin.x += tableBorderLeft; // make the table begin a few pixels right from its origin tableRect.size.width -= tableBorderLeft + tableBorderRight; // reduce the width of the table tableView.frame = tableRect; } 解决scheme#2:通过图像渲染单元格 这个解决scheme在这里描述: http […]