【发布时间】:2016-04-25 10:29:22
【问题描述】:
我正在尝试在获取 JSON 数据后根据内容调整 UITableViewCell 的高度。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewAutomaticDimension;
}
我已经添加了这样的内容,但 UITableViewCell 的高度不能根据内容增加。请帮我解决一下。
- (void) getAllocatedJobs {
_allTableData = [[NSMutableArray alloc]init];
[SVProgressHUD show];
dispatch_queue_t getInit = dispatch_queue_create("getinit",NULL);
dispatch_async(getInit, ^{
NSDictionary *jsonResponse = [commClass getJobs:strDriverId paramJobType:@""];
NSNumber *status = [jsonResponse valueForKey:@"Success"];
NSString *message = [jsonResponse valueForKey:@"Message"];
NSArray *dataArray = [jsonResponse valueForKey:@"lstJob"];
dispatch_async(dispatch_get_main_queue(), ^{
if([status intValue] == 1) {
for(int i=0; i<[dataArray count]; i++) {
NSDictionary *JobData = [dataArray objectAtIndex:i];
[_allocatedTable reloadData];
} else {
[commClass showAlert:APP_NAME alertMessage:message];
[SVProgressHUD dismiss];
}
});
});
}
【问题讨论】:
标签: ios objective-c json uitableview