[英]Trouble changing appearance of cells in uitableview
I'm using the delegate method tableview: willDisplayCell: forRowAtIndexPath to make visual changes to my UITableViewCell's with. 我正在使用委托方法tableview:willDisplayCell:forRowAtIndexPath对UITableViewCell进行视觉更改。 The problem is that this only seems to work after I scroll through the table.
问题在于,这仅在我滚动浏览表格后才起作用。 The cells that are shown before I scroll don't have a change until I scroll.
滚动之前,滚动前显示的单元格没有更改。 My delegate method is as follows:
我的委托方法如下:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.frame = CGRectMake(0,0,300.0f,100.0f);
}
Any ideas as to how I get the initial cells to look the same as they do once I scroll? 关于如何使初始单元格看起来与它们滚动后的外观相同的任何想法?
I don't think you can change the frame of a cell during 我认为您不能在更改过程中更改单元格的框架
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
try this instead. 试试这个吧。
- (void)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.