0

私のView Controllerには、Parse.comからのPFQueryによって呼び出されるカウンターデータの機能を持つラベルがあります..これらのデータはいつでも変更される可能性があります。

ユーザーがアプリでセーリングしていなくても、databrowser でデータが変更されると、このラベルが自動的に更新される必要があります。

TableView に関しては、ある種のラベルの自動リロードが必要だとしましょう。どのようにできるのか?正しい方法を知っている人はいますか?

4

1 に答える 1

1

pfLabelそれは非常に簡単です。セルに a があると仮定します。

次のデリゲート メソッドでクエリを実装します。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath {
 ..................
 // Do stuff here.
 PFQuery *yourQuery = [PFQuery queryWithClassName:@"YOUR_PARSE_CLASS_NAME"];
 // Implement your query constraint here, after that, get your desired data and show it using your desired label
[yourQuery findObjecsInBackgroundWithBlock:^(NSString* obj) {
    pfLabel.text = obj;
}];
// Congrat, you just have your label asynchronously showed your parse data.
.....................
}
于 2013-10-25T00:18:13.540 に答える