当用户点击加号按钮插入行时 UITableView 响应

Posted

技术标签:

【中文标题】当用户点击加号按钮插入行时 UITableView 响应【英文标题】:UITableView respond when user taps the plus button to insert row 【发布时间】:2011-07-11 22:55:55 【问题描述】:

当用户在我的 UITableView 中点击“添加新行”绿色加号按钮时,我使用什么方法知道?

【问题讨论】:

你有没有在按下按钮时被调用的函数? 【参考方案1】:

请参阅Table View Programming Guide 的“插入和删除行和节”部分

【讨论】:

【参考方案2】:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
    if (editingStyle == UITableViewCellEditingStyleInsert) 
    //your code here
    NSLog(@"user tapped insertion control");
       

【讨论】:

以上是关于当用户点击加号按钮插入行时 UITableView 响应的主要内容,如果未能解决你的问题,请参考以下文章