View Changes in a UITableView Update

I have a rather complicated form outlined in UITableView. This form has several UICollectionViewinside the table view cell, as well as some collectors that appear just like in the Calendar application:

Image

Now, when I do this in my application, one of UICollectionViewmine is taller than the way it started - and it continues to move (I added a red frame to make sure that it was resized UICollectionView):

Image

I tried to debug the view property UICollectionView, but it never changes (and its getter / setter doesn't call anymore than I expected), although when printed on cellForRowAtIndexPathit shows a resize. Is there a way to debug this better or was someone in the same situation?

Thank!

the code:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//self.campos is a dictionary with sections and rows stored
    NSMutableArray *infoCampos = [[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"];
NSDictionary *infoCampo = [infoCampos objectAtIndex:indexPath.row];

if ([[infoCampo objectForKey:@"nome"] isEqualToString:@"dosePorComprimido"]) {
    //Remove picker cell if finds it
    for (infoCampo in infoCampos) {
        if ([infoCampo objectForKey:@"view"] == self.dosagemMedicamento.view) {
            [infoCampos removeObject:infoCampo];
            [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];
            [tableView deselectRowAtIndexPath:indexPath animated:YES];
            return;
        }
    }

    //Insert new cell
    infoCampo = [infoCampos objectAtIndex:indexPath.row];
    [infoCampos addObject:@{@"tipo":@5, @"view":self.dosagemMedicamento.view, @"nome":[infoCampo objectForKey:@"nome"]}];
    [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];
    [self.dosagemMedicamento.view.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[pickerDosagem]|" options:0 metrics:nil views:@{@"pickerDosagem":self.dosagemMedicamento.view}]];
}
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
    UIView *view;

    if ([infoCampo objectForKey:@"view"]) {
        view = (UIView *) [infoCampo objectForKey:@"view"];
        return view.frame.size.height;
    }

    return 44.0f;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:

(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    NSMutableDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
    UIView *view;

cell = [tableView dequeueReusableCellWithIdentifier:[[infoCampo objectForKey:@"nome"] stringByAppendingString:@"ViewLinhaCellView"] forIndexPath:indexPath];

        view = [cell viewWithTag:1];

        [view addSubview:[infoCampo objectForKey:@"view"]];

return cell;
}

EDIT: , reloadData, / reloadRowsAtIndexPaths reloadSections. , .

EDIT 2: e

+3
1

, , tableView:heightForRowAtIndexPath:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
    UIView *view;

    if ([infoCampo objectForKey:@"view"]) {
        view = (UIView *) [infoCampo objectForKey:@"view"];
        return view.frame.size.height;
    }

    return 44.0f;
}

, , . , , , - . , , , :

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
    UIView *view;

    if ([infoCampo objectForKey:@"view"]) {
        if ([infoCampo objectForKey:@"viewHeight"]) {
            return [[infoCampo objectForKey:@"viewHeight"] floatValue];
        } else {
            return 216.0f;
        }
    }

    return 44.0f;
}

viewHeight , (216), .

+2

All Articles