我有两种看法。 第一个:第一个 View Controller 第二:SecondViewController
FirstView Controller 是我的 UINavigationController 的根 Controller ,里面有一个表。单击单元格时, View 将导航到 SecondViewController。在 SecondViewController 中,我试图放置一个 UIPickerView。
在 SecondViewController.h 中,我有:
@interface SearchOptionController : UIViewController {
IBOutlet UIPickerView *pickerView;
NSMutableArray *optionArray;
}
@property (nonatomic, retain) IBOutlet UIPickerView *pickerView;
@property (nonatomic, retain) NSMutableArray *optionArray;
@end
在 SecondViewController.m 中我有:
@synthesize pickerView;
以及所有pickerview方法。
我从界面生成器中添加了 UIPickerView,并为委托(delegate)和数据源选择了文件所有者。但是,当 ViewDidLoad 方法在 SecondViewController 中结束时,应用程序崩溃并显示:
Program received signal: SIGABRT
第二行:
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
我应该做什么来防止这种崩溃并让 View 加载 uipickerview?
编辑:
当我从 Interface Builder 中删除 UIPickerView 时,应用程序可以正常运行。我想我在将 UIPickerView 放入 UIView 时遇到了一些问题,但我无法处理,新手很难。
最佳答案
您需要确保已实现该对象的委托(delegate)方法。
关于iphone - UIPickerView 导致应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5978341/