gpt4 book ai didi

ios - 自动重新加载 UiLabel 数据

转载 作者:行者123 更新时间:2023-11-29 03:32:36 25 4
gpt4 key购买 nike

在我的 View Controller 中,我有一个标签,它具有由 Parse.com 的 PFQuery 调用的计数器数据功能。这些数据可能随时更改。

我需要当数据浏览器中的数据发生变化时自动更新此标签,即使用户没有在应用程序中航行。

假设我需要对 TableView 标签进行某种自动重新加载。我能怎么做?有谁知道正确的方法吗?

最佳答案

这非常简单,假设您的单元格中有一个 pfLabel

在以下委托(delegate)方法中实现您的查询:

- (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.
.....................
}

关于ios - 自动重新加载 UiLabel 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19569929/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com