有问题的应用程序是一个简单的示例程序。在我的视图控制器头,我已经按钮实例化为例如:当从NIB加载视图时,iPhone程序立即退出
@interface ObscurelyNamedViewController : UIViewController {
UIButton *yoButton;
}
@property(nonatomic, retain) IBOutlet UIButton *yoButton;
- (IBAction)yoButtonPressed:(id)sender;
yoButtonPressed:被实现为这样:
[yoButton setTitle: @"I said 'yo', jammit!" forState: UIControlStateNormal];
// repeat for other button states
.
.
.
在界面生成器,我已连接的UIButton的润色内部事件到文件所有者ObscurelyNamedViewController
中的yoButtonPressed方法来识别触摸。作为回报,我已将文件所有者的出口连接回yoButton,以便更新其标题。
当我构建并运行时,我没有收到任何错误,但没有显示,应用程序立即退出。居住在IB的唯一的其他东西是UIImage视图。我错过了什么,或者我错误地连线了什么?
编辑:在控制台中,我看到以下消息:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "BradiiCaliiViewController" nib but the view outlet was not set.'
当它退出时,您应该在控制台中收到一条消息。有太多这可能是错误的 - 需要消息来帮助 – 2011-03-06 21:24:59
再次有这个问题,但这次无法连接视图插座。解决和张贴在这里:http://stackoverflow.com/questions/5227332/view-outlet-not-available-to-files-owner – 2011-03-08 01:37:14