- (void)deleteRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;删除报错问题

前几天做UItableView删除cell的时候报了这个错:

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-3347.44.2/UITableView.m:1623

错误代码如下:

- (IBAction)deleteClick:(UIButton *)sender {

    NSArray *array =  _mTableView.indexPathsForSelectedRows;

    [_mTableView deleteRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationFade];
    [self selectCancel:nil];

}

页面效果如下:

网上查了一下,说是没有移除数据源,所以修改了一下代码,将数据移除了,解决了这个问题

- (IBAction)deleteClick:(UIButton *)sender {

    NSArray *array =  _mTableView.indexPathsForSelectedRows;

    NSMutableIndexSet *set = [[NSIndexSet indexSet] mutableCopy];
    for (NSIndexPath *path in array) {
        [set addIndex:path.row];
    }

    [_woDeArray removeObjectsAtIndexes:set];

    [_mTableView deleteRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationFade];
    [self selectCancel:nil];

}
时间: 2024-08-08 09:21:19

- (void)deleteRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;删除报错问题的相关文章

jsonkit 解析nsarray 时候 报错

jsonkit 解析nsarray 时候 报错 Assertion failure in -[TXJKArray count], /Users/mqq/hudson/1740/src/TencentOpenApi_IOS/Common/Util/JSONKit.m:738 解决办法: Had the same issue, I was trying to set the output straight to a dictionary I had created. myDictionary = [

项目实战中遇到的关于transition 和 animation 的犯错体会

响应式简历里面的头像边框要求鼠标悬停在头像区域时,box-shadow放大后再缩小的闪烁效果 一开始用的transition,效果接近,但没有闪烁效果 .user-inform .user-img { margin-top: 80px; margin-left: auto; margin-right: auto; width: 120px; height: 120px; background-color: white; border-radius: 50%; box-shadow: 0 0 0

- (void)addConstraints:(NSArray&lt;__kindof NSLayoutConstraint *&gt; *)constraints

Adds multiple constraints on the layout of the receiving view or its subviews.   All constraints must involve only views that are within scope of the receiving view. Specifically, any views involved must be either the receiving view itself, or a subv

Fouandation(NSString ,NSArray,NSDictionary,NSSet) 中常见的理解错误区

Fouandation 中常见的理解错误区 1.NSString //快速创建(实例和类方法) 存放的地址是 常量区 NSString * string1 = [NSString alloc]initWithString:@“123”]; NSString * string3 = [NSString stringWithString:@“123”]; //格式化方法创建   存放地址是堆区 NSString * string2 = [NSString alloc]initWithFormat:@

微信SDK导入报错 Undefined symbols for architecture i386:&quot;operator delete[](void*)&quot;, referenced from:

异常信息: Undefined symbols for architecture i386:  "operator delete[](void*)", referenced from:      +[WeChatApiUtil EncodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)      +[WeChatApiUtil NsDataEncodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)    

Myeclipse报错--&gt;Animation Start An internal error has occurred. java.lang.NullPointerException解决

参考地址:https://blog.giuseppeurso.net/eclipse-pdt-animation-start-an-internal-error-has-occurred-java-lang-nullpointerexception/

tableView 编辑模式

UITableView 编辑模式详解 UITableView 的相关编辑操作非常全,今天我们来做一个总结.跟编辑相关的属性和接口有如下,我们一个一个分析,我们先认真阅读一下相关头文件,我根据意思大概翻译了一下注释. 属性方法 @property (nonatomic, getter=isEditing) BOOL editing; // 默认状态是非编辑状态,如果不调用下面接口直接设置,是没有动画的 - (void)setEditing:(BOOL)editing animated:(BOOL)

iOS开发 -------- UITableView的编辑

一 核心API Class: UITableView Delegate: UITableViewDataSource, UITableViewDelegate 涉及到的API: 插入和删除 1 /** 2 * 让tableView进入或退出编辑状态(TableView方法) 3 */ 4 - (void)setEditing:(BOOL)editing animated:(BOOL)animated; 5 6 /** 7 * 指定哪些行的cell可以进行编辑(UITableViewDataSou

UITableView API大百科

UITableView接口 常规 - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style 初始化方法,调用init方法初始化时默认style为UITableViewStylePlain @property (nonatomic, readonly) UITableViewStyle style; 表视图类型,包括UITableViewStylePlain和UITableViewStyleGrouped @