【发布时间】:2011-05-31 13:33:56
【问题描述】:
在我的应用程序中,我正在推送一个视图控制器(UITableViewController),它还有一个引用 UITableViewCell 的属性/出口。似乎使用以下方法创建控制器:
PreferencesController *pController = [[PreferencesController alloc] init];
不会为xib文件中的UITableViewCell创建对象,因此outlet为null,因此表加载会产生异常。 我解决了这个问题:
PreferencesController *pController = [[PreferencesController alloc] initWithNibName:@"PreferencesController" bundle:nil];
但我并没有真正明白它为什么会起作用,因为从文档看来,init 似乎足以加载相关的 nib 文件 (PreferencesController.xib)。
【问题讨论】:
标签: ios uitableview uiviewcontroller init