如何将NSIndexPath转换为NSString-iOS

我想将NSIndexPath转换为NSString.我该怎么办?
我必须使用这个:

- (void)restClient:(DBRestClient*)client uploadedFile:(NSString*)sourcePath 
{
    [client deletePath:@"/objc/boston_copy.jpg"];
}

在commitEditingStyle方法中,我只获得NSIndexPath作为输入.

- (void)tableView:(UITableView *)aTableView 
        commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
        forRowAtIndexPath :(NSIndexPath *)indexPath 
{                  
    [self.itemArray  removeObjectAtIndex:indexPath.row];          
    [aTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] 
                      withRowAnimation:YES];    
    [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]
                  withRowAnimation:UITableViewRowAnimationFade];   
}  
最佳答案
我在一个时间点在NSIndexPath上创建了这个类别:

@interface NSIndexPath (StringForCollection)

-(NSString *)stringForCollection;

@end

@implementation NSIndexPath (StringForCollection)

-(NSString *)stringForCollection
{
    return [NSString stringWithFormat:@"%d-%d",self.section,self.row];
}

@end

转载注明原文:如何将NSIndexPath转换为NSString-iOS - 代码日志