我有 2 个 UILables:
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];
}
}
如果我的分数大于他的分数,我该如何比较?我的代码不起作用。请帮忙。