在iPhone sdks中逐个拆分字符串

时间:2011-12-14 03:22:17

标签: objective-c

我有一个包含tableview单元格中多个值的字符串,字符串可能是多个或单个值。我需要将这些值导出到googledoc。我已经完成了,但我的问题是字符串中的值被导出到googledoc在一个文件夹中,我不想要这个,我必须分割字符串继续多个值,如果它是一个多值字符串,则单独上传它。

我上传的代码是

- (IBAction)doUpload:(id)sender
{
     NSMutableString *str = [[NSMutableString alloc] initWithString:@"NOTES:"];
    for (int i = 0; i<[appDelegate.notesArray count]; i++) {
        // UPLOAD STRINGS HERE
        if (selected[i])
            [str appendFormat:@"%@ ,",[appDelegate.notesArray objectAtIndex:i]];

    }
        UploadView *uploadview = (UploadView *)self.view;
        if (uploadview != nil)
        {
                     [m_owner uploadString:str];

            }
 }

我的tableviewcode didSelectRowAtIndexPath

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

   NSUInteger row = [indexPath row];


    selected[row] = !selected[row];
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = selected[row] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}

怎么做,请帮帮我。 提前谢谢。

1 个答案:

答案 0 :(得分:2)

在追加之前做上传......