这几天写功能用到了UITableView,cell只有7个,但是重用的却是很严重。于是网上搜了很多方法,可还是重用。问了下人找到了一个另类的方法。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// static NSString *identifier = @"cell";
SMCell *smcell = [tableView dequeueReusableCellWithIdentifier:nil];
if (!smcell) {
smcell = [[SMCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
}
这个方法是取消tableview的重用,cell不多的可以参考,如果cell比较多就不推荐了。新手上路,还有好方法请回复。