我想在用户在IPhone应用程序中触摸按钮时弹出一个简单的消息窗口。我用UIAlertView中的类,在执行这样的代码:IOS UIAlertView未显示
-(IBAction)sendMessage:(UIButton *)sender
{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"test message"
message:@"test"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
我也挂的sendMessage方法动作里面润色。
什么也没有显示。
有什么想法吗?我是iOS编程新手。 感谢您的帮助。
使用断点,以确保'[警报显示]'被调用 –
是的,从一般的调试,例如断点,是一个良好的开端。但是这个问题需要更多的信息才能得到正确的回答。初始者的IB连接镜头。 –
如果调用'sendMessage'并且应用程序没有崩溃,那么'[alert show];'几乎肯定会被调用。我的猜测是'sendMessage'实际上没有被调用。 – nhgrif