AlertView错误预期':'

时间:2012-11-08 06:28:21

标签: objective-c

- (void)showMessageError {
alertMessage = [[UIAlertView alloc] initWithTitle:@"Impossible"
                                                  message:@"Here are the problems:\n%@,\n%@,\n%@",self.Error1,self.Error2,self.Error3
                                                 delegate:self
                                                 cancelButtonTitle:@"OK"
                                                 otherButtonTitles:nil];
[alertMessage show];
}

我只是想显示这个AlertView只有cancelButtonTitle但我在委托附近收到错误:self 预期 ':'

为什么?

1 个答案:

答案 0 :(得分:2)

alertMessage = [[UIAlertView alloc] initWithTitle:@"Impossible"
                                              message:[NSString stringWithFormat:@"Here are the problems:\n%@,\n%@,\n%@",self.Error1,self.Error2,self.Error3]
                                             delegate:self
                                             cancelButtonTitle:@"OK"
                                             otherButtonTitles:nil];

试试这个