iphone - 如何从 TableView IOS 中删除一行

标签 iphone objective-c ios xcode

我想在不使用以下数据源方法的情况下从 TableView 中删除一行。怎么做?

- (void) tableView : (UITableView *)tableView 
commitEditingStyle : (UITableViewCellEditingStyle)editingStyle 
 forRowAtIndexPath : (NSIndexPath *)indexPath 

最佳答案

[UITableView deleteRowsAtIndexPaths: withRowAnimation:]怎么样? ?

(我已经为您链接了 Apple 的文档)。

@Scar 的想法也不错,但是这会刷新整个表格,如果用户滚动到表格底部并且刷新将他们带到顶部,这可能会对用户造成一些干扰。

关于iphone - 如何从 TableView IOS 中删除一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11876838/

相关文章:

iphone - iOS 3.1.3 上的手势检测

ios - -canOpenURL : failed for URL: "fbauth2:/" - error: "(null)"

ios - 代码 5 : Is there any way to group/filter/sort what shows up in code-completion?

iphone - AFNetworking:setImageWithURLRequest 未设置图像

ios - 是否可以通过 watch 连接将复杂的数组从 iPhone 发送到 Apple Watch?

iphone - 将导航栏添加到 detailview 和 tableview

ios - 在 native iOS 应用程序中使用类似 Redux 的模式是一种好习惯吗?

ios - 在 ScrollView 中调整了 UITableView 的大小,内容 View 未调整大小

iphone - 来自 {PRODUCT_NAME} 的 XCode 包标识符格式

ios - Xcode 4.2或4.6的iOS 7部署