【发布时间】:2017-04-12 10:14:25
【问题描述】:
我在尝试更新通过情节提要连接的 UILabel 时遇到问题。当我将我的数据注销时,它会很好地显示在控制台中,但我的标签没有按应有的方式更新:
CZWundergroundRequest *request = [CZWundergroundRequest newConditionsRequest];
request.location = [CZWeatherLocation locationFromCoordinate: currentLocation];
request.key = @"";
[request sendWithCompletion:^(CZWeatherData *data, NSError *error) {
self.currentTemperatureLabel.text = [NSString stringWithFormat:@"%f", data.current.temperature.f];
NSLog(@"%f", data.current.temperature.f);
}];
当我更新 ViewDidLoad 中的标签时,它工作得很好,但是一旦我尝试向它发送数据,它就不会更新。我也尝试取下标签并重新安装插座。有什么想法吗?
【问题讨论】:
-
尝试在主线程中更新
-
始终在主线程中更新 UI 元素。
标签: ios objective-c storyboard