ViewControllerA を使用AFNetworking
してファイルをダウンロードsetDownloadProgress
し、進行状況でモデルを更新できます。UITableView
また、すべての転送のリストを持つ ViewControllerB もあります。
内部cellForRowAtIndexPath
で私は自分のモデルを観察します
[transfer addObserver:cell
forKeyPath:@"completed"
options:NSKeyValueObservingOptionNew
context:NULL];
これは機能し、次のような進行状況を読み取ることができます
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:@"completed"]) {
float val = [[change objectForKey:@"new"] floatValue];
NSLog(@"%f", val);
}
}
しかし、UITableViewCell を KVO で更新する方法がわかりません。