我知道这听起来可能是个愚蠢的问题,但我已经到处找了.我该怎么做?

我知道如何使用swype to delete方法来实现这一点,但在该函数之外我如何实现它呢?

请发布一些代码示例.

谢谢

推荐答案

[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];

insertIndexPaths是要插入到表中的NSINDExpatharray.

deleteIndexPaths是要从表中删除的NSINDExpatharray.

索引路径的数组格式示例:

NSArray *insertIndexPaths = [[NSArray alloc] initWithObjects:
        [NSIndexPath indexPathForRow:0 inSection:0],
        [NSIndexPath indexPathForRow:1 inSection:0],
        [NSIndexPath indexPathForRow:2 inSection:0],
        nil];

Objective-c相关问答推荐

iOS中的非延迟图像加载

等到多个网络请求都执行完毕 - 包括它们的完成块

如何更改图像中的特定 colored颜色 ?

ARC的正确桥接?

在 viewDidAppear 之前无法正确设置框架

如何连续关闭 2 个模态视图控制器?

如何构建一个 Objective-C 静态库?

try 标记应用程序图标但未获得用户标记应用程序的权限:iOS 8 Xcode 6

UIWebView 不会zoom 内容以适应

如何测试生产推送通知?

无法加载从笔尖引用的图像

在Objective-C中替换字符串中的多个字符?

如何在情节提要场景中嵌入自定义视图 xib?

如何设置 NSPredicate 来查找具有 nil 属性的对象

深入了解保留周期

在 iOS UILabel 上设置 BOLD 字体

为整个 iPhone / iPad 应用程序设置背景图像

UICollectionView 断言失败

有没有办法在不使用 UINavigationController 的情况下更改 Storyboard 中 UINavigationBar 的高度?

使用 [NSDate date] 获取当前日期和时间