0

I get an array of another class, and make changes to this class, but when I do a reloadData not much happens. What is wrong?

This is my code

#pragma mark TesteFaceCarViewController methods

-(void)valores:(NSMutableArray *)array
{
    arrayInfracao = array;
    NSLog(@"Quantidade :%d", arrayInfracao.count);
    [table reloadData];
}

#pragma mark TableView

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSLog(@"Passei aqui!");
    NSLog(@"Quantidade :%d", arrayInfracao.count);
    return arrayInfracao.count;

}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    Infracao *infracao = [[Infracao alloc] init];
    infracao = [arrayInfracao objectAtIndex:indexPath.row];
    cell.textLabel.text = infracao.dsInfracao;
    return cell;
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • @Fabricio try to create new array from the array you got from other class. Like this arrayInfracao = NSMutableArray(array: array) then reload your table. – Chirag Shah Jul 11 '18 at 07:58

1 Answers1

0

You are welcome!

[self.table reloadData];

Jordan
  • 21,746
  • 10
  • 51
  • 63