vendredi 28 août 2015

Why is my if statement not being called?

I'm using if statements in cellForRowAtIndexPath: so I can populate cells with the right images.

if ([object objectForKey:@"type"] == [NSNumber numberWithInt:0]) {

    self.cell.typeImage.image = [UIImage imageNamed:@"type1"];
}

else if ([object objectForKey:@"type"] == [NSNumber numberWithInt:1]) {

    self.cell.artTypeImage.image = [UIImage imageNamed:@"type2"];
}

else if ([object objectForKey:@"type"] == [NSNumber numberWithInt:2]) {

    self.cell.artTypeImage.image = [UIImage imageNamed:@"type3"];
}

I do get a value for [object objectForKey:@"type"] as it does not return nil.

Aucun commentaire:

Enregistrer un commentaire