我有一个名为sendWO的IBAction链接按钮。这应该是非常简单的,也许我错过了UIAlertView类的一些基本概念。它连接在我的viewcontoller中,如果我输入一些NSLog,我知道按钮正在调用sendWO类,它只是不显示警报。没有警告/崩溃或类似的事情。我已经尝试过使用委托:nil,sender,self,并完全删除参数。
- (IBAction)sendWO:(id)sender
{
NSString *theMessage = [NSString stringWithFormat:@"Thank you! We will call you shortly at %@ to confirm.",choices.customerPhone];
UIAlertView *alert = [alert initWithTitle:@"Thank you!" message:theMessage
delegate:sender cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
答案 0 :(得分:1)
你遗漏了一些简单的东西:
您必须分配alertview
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thank you!" message:theMessage
delegate:sender cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert autorelease];