我想在获取JSON数据后根据内容调整UITableViewCell的高度。获取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];
}
});
});
}