dimanche 30 août 2015

Objective C NSNumbers in if statements

Hi I am retrieving an NSNumber value from an array (a rating e.g. 4.3) and am then need to test this value to then assign star rating images.

However when I write the if statement, I am getting errors "Expected Expression"

Here is the code:

if (rating >=1 && <2) {
        return [UIImage imageNamed:@"1starimage"];
    }else if (rating  >=2 && <3){
        return [UIImage imageNamed:@"2starimage"];
    }

Thanks for any explanation on how I can do this without causing errors.

Aucun commentaire:

Enregistrer un commentaire