-3

错误是:“UIAlertview 没有可见的@Interface 声明选择器'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitle:'”

- (void) subtractTime;
{
     seconds --;
     timerLabel.text = [NSString stringWithFormat:@"Time: %i", seconds];

     if(seconds == 0)
     {
         [timer invalidate];
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Time is up !"
                              message: [NSString stringWithFormat: @"You Scored %i points", count]
                              delegate:self
                              cancelButtonTitle: @"Play Again?"
                              otherButtonTitle:nil];
     }
}
@end
4

1 回答 1

5

您的代码中有错字。

它应该是:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Time is up !"
                                                message: [NSString stringWithFormat: @"You Scored %i points", count]
                                               delegate:self
                                      cancelButtonTitle: @"Play Again?"
                                       otherButtonTitles:nil];

请注意,它是“otherButtonTitles”,而不是“otherButtonTitle”。

于 2013-07-20T14:44:29.620 回答