本吧须知01-18〖吧务公布〗TableView删除一行后第一个Cell变了
ios开发吧
全部回复
仅看楼主
level 5
liucong810 楼主
TableView删除一行后第一个Cell变了
2016年01月18日 04点01分 1
level 5
liucong810 楼主
别沉了
2016年01月18日 04点01分 2
level 5
liucong810 楼主
在线等
2016年01月18日 04点01分 3
level 5
liucong810 楼主
实在找不到原因了!
2016年01月18日 04点01分 4
level 5
liucong810 楼主
等等等
2016年01月18日 05点01分 5
level 5
cell重用
2016年01月18日 05点01分 6
我时用的cell重用!但只有一行有这个情况!纳闷了
2016年01月18日 05点01分
level 5
liucong810 楼主
会不会是和TabBer有冲突什么的
我没加TabBer前没这个问题
2016年01月18日 05点01分 7
level 5
liucong810 楼主
来大神啊!救救我吧
2016年01月18日 07点01分 8
level 4
贴个关键性代码出来,这个问题不好说
2016年01月18日 09点01分 9
level 5
liucong810 楼主
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *collechLabelIdentifier = @"collechLabelIdentifier";
dishListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:collechLabelIdentifier];
if (cell == nil) {
cell = [[dishListTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:collechLabelIdentifier];
}
cell.collechResult = self.collechArray[indexPath.row];
return cell;
}
这是我的Cell
2016年01月18日 15点01分 11
level 5
liucong810 楼主
-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
searchResult *s = self.collechArray[indexPath.row];
[DatabaseTool delectData:[NSString stringWithFormat:@"%ld",s.ID]];
self.collechArray = [DatabaseTool query];
[self.collechTableView reloadData];
}];
return @[deleteRowAction];
}
这是我的左划删除按钮
2016年01月18日 15点01分 12
level 5
liucong810 楼主
求指点
2016年01月18日 15点01分 13
level 5
liucong810 楼主
@_既白 帮我看看
2016年01月19日 02点01分 14
level 4
没看出来问题,建议在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
加上frame属性给X定为0
cell.frame
同时
static NSString *collechLabelIdentifier = @"collechLabelIdentifier";
2016年01月19日 03点01分 15
试了一下!不是这里问题!效果还是一样
2016年01月20日 05点01分
level 4
试试 不行在想别的招,昨一晚上你没弄出来?
2016年01月19日 03点01分 16
因为我都没动过Cell的frame所以,我找了半天都无从下手
2016年01月19日 09点01分
@liucong810 解决没
2016年01月20日 02点01分
@_既白 还是没解决[泪]
2016年01月20日 05点01分
1 2 尾页