lundi 19 novembre 2018

Objective C, If statement with multiple buttons' text

I am writing code for "Tic Tac Toe" for a school project. I am trying to write an if statement for when 3 buttons' titles all equal X that a label's text will change to "X Wins!". My code so far is:

if (([topLEFT.titleLabel.text isEqualToString:@"X"] && [topMIDDLE.titleLabel.text isEqualToString:@"X"] && [topRIGHT.titleLabel.text isEqualToString:@"X"]))
{
    Winner.text = @"X Wins!";
}

What can I change to make this work?

Aucun commentaire:

Enregistrer un commentaire