我试图在视图出现后立即显示警报视图(不使用按钮)。在 viewcontroller.m 我有:
- (void) viewWillAppear:(BOOL)animated
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"User Information" message: @"Hello"
delegate: self cancelButtonTitle:nil otherButtonTitles: @"Continue", nil];
[alert show];
[alert release];
}
在 viewcontroller.h 我有:
IBOutlet UIView *alert;
我没有对我的 .xib 文件做任何事情。
在模拟器上运行时,我在控制台中得到以下信息:
2009-11-30 23:41:36.079 BatteryApp [867:20b] *** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“-[UIViewController _loadViewFromNibNamed:bundle:] 加载了“BatteryAppViewController”笔尖,但视图出口没有设置。
有什么想法我出错了,与我的 xib 有关吗?
编辑//我将警报连接到我的 xib 中的新视图,仍然没有运气