Handling custom cell constraints

0

I am new to objective-c, I am managing a list with custom cells which show information through several labels, I do not use autolayout for compatibility problems between old apple devices, the problem I have is that when I turn the cell phone screen I do not know how to control the labels that are in the cells to adjust them and improve the presentation. From the controller of the list he used the following code to call my cell:

-(UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
cellGir *celda = [tableView dequeueReusableCellWithIdentifier:@"cellGir"];
if (celda == nil)
{
    [self.utvGir registerNib:[UINib nibWithNibName:@"cellGir" bundle:nil] forCellReuseIdentifier:@"cellGir"];
    celda = [[[NSBundle mainBundle] loadNibNamed:@"cellGir" owner:self options:nil]objectAtIndex:0];
    //celda = _VistaCelda;
    //self.VistaCelda = nil;
}
//[celda setInfo:[[clsGir alloc] initWithDict:[Datos objectAtIndex:indexPath.row]]];
[celda setNeedsLayout];
return celda;
}

And with this I fill it when I show

-(void) tableView:(UITableView *)tableView willDisplayCell:(cellGir *)cell 
forRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell setInfo:[[clsGir alloc] initWithDict:[Datos objectAtIndex:indexPath.row]]];
}

I have tried with [cell setNeedsLayout] which is the closest to what I want, it does not do anything at the moment but if I touch the cell it refreshes me from the Frame of the label that I programmed, but it is not the idea.

I do not know if I can do that from the cell the constraints are programmed, same with layoutSubviews, with setNeedsLayout it does not do anything.

The labels I defined from the storyboard do not know how to intercept the process when creating the cell, cancel the predefined constraints and assign custom ones by me.

On the side of the cell I do not have much to show, in the .h I only have the connections to the labels and the definition of a method that sets the values by means of an object.

I've already gone through hundreds of pages asking the same thing, but I have not found anything that works for me.

    
asked by Arbac 13.03.2018 в 22:54
source

0 answers