我收到错误消息:expected ':'
可能是因为下面的短语initWithTitle:@"You downloaded %i boards", iboard
。你能帮我解决一下吗?
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You downloaded %i boards", iboard message:@"Press Ok to continue" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
答案 0 :(得分:2)
替换
initWithTitle:@"You downloaded %i boards", iboard
与
initWithTitle:[NSString stringWithFormat:@"You downloaded %i boards", iboard]
答案 1 :(得分:2)
你的代码搞得一团糟。
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You downloaded %i boards", iboard message:@"Press Ok to continue" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
应该是:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"You downloaded %i boards", iboard]
message:@"Press Ok to continue"
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];