像即时通讯一样在tableview中异步上传图片

Asynchronous image uploading in tableview like instant messaging

我正在使用发送照片的选项进行消息传递,一旦选择图像,它将上传到服务器并显示在 chatTableview 列表中。但是我希望 chatTableview 的单元格也显示照片上传的进度。谁能告诉我如何根据照片上传状态更新 chatTableview 的单元格,就像在微信中一样?enter link description here

你好,多线程应该可以吧~ 例如,

NSBlockOperation *operation1 = [NSBlockOperation blockOperationWithBlock:^{
    NSLog(@"sending photo and update the progress of photo - %@", [NSThread currentThread]);
......
}];
NSBlockOperation *operation2 = [NSBlockOperation blockOperationWithBlock:^{
    NSLog(@"doing the messaging   - %@", [NSThread currentThread]);
......
}];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[queue addOperations:@[operation1, operation2] waitUntilFinished:NO];