Im getting json data from the backend , and displaying them in the tableview. each object is displayed in a cell, some objects have same names, other have different.
the problem is when I am scrolling the tableview, the object names are changing. My code in cellForRow atIndex path:
static NSString *cellIdentifier = @"cell2";
ProccessingOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
Order *order = self.orderArray[indexPath.row];
NSString *role = [NSUserDefaults.standardUserDefaults objectForKey:@"userRole"];
if([role isEqualToString:@"brand.operator"]){
cell.branchName.hidden = NO;
NSString *roleDisplay = [NSString stringWithFormat:@"%@%@", @"Branch name: " ,order.branch.name ] ;
cell.branchName.text = roleDisplay;
} else if([role isEqualToString:@"corporate.operator"]){
cell.branchName.hidden = NO;
NSString *roleDisplay = [NSString stringWithFormat:@"%@%@ \n%@%@", @"Branch name: " , order.branch.name,@"Brand name: ",order.branch.brand.name ] ;
cell.branchName.text = roleDisplay;
} else {
cell.branchName.hidden = YES;
}
the field "cell.branchName.text" is changing on scrolling,
Any idea whats happening?