UITableView 中实现 滑动一个cell 显示一个按钮,并且做相关业务处理

来源:互联网 发布:怎么看淘宝的实名认证 编辑:程序博客网 时间:2024/06/06 01:29
//当在Cell上滑动时会调用此函数-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{    NSLog(@"点击了收藏,开始收藏功能");    NSUInteger row = [indexPath row];    NSDictionary * rowData =  [itemArray objectAtIndex:row];    NSLog(@"准备收藏的路段名称是:%@", [[NSString alloc]initWithFormat:@"%@",[rowData objectForKey:@"road_name"] ]);}/*此时删除按钮为Delete,如果想显示为“删除” 中文的话,则需要实现 UITableViewDelegate中的- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath方法*/- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{    return @"收藏";}

相关 文章 http://code.eoe.cn/476.html

原创粉丝点击