私は2つのUILableを持っています:
myScore.text; および hisScore.text;
NSTimer が 0 になると、次のコードが表示されます。
if (MainInt <= 0) {
[Mytimer invalidate];
if (myScore.text < hisScore.text) {
UIAlertView *win = [[UIAlertView alloc]initWithTitle:@"Congrats" message:@"You WIN" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[win show];
}
else if(myScore.text > hisScore.text) {
UIAlertView *lose = [[UIAlertView alloc]initWithTitle:@"Hmmmm" message:@"You lose :(" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[lose show];
}
else if(myScore.text == hisScore.text) {
UIAlertView *tie = [[UIAlertView alloc]initWithTitle:@"Not Bad" message:@"No winners. TIE" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[tie show];
}
}
私のスコアが彼のスコアよりも高い場合、どのように比較できますか? 私のコードは動作しません。助けてください。