UIPickerView导致应用程序崩溃

时间:2011-05-12 13:00:01

标签: iphone uitableview uinavigationcontroller uipickerview

我有两个观点。 第一:FirstViewController 第二:SecondViewController

FirstView Controller是我的UINavigationController的根控制器,我有一个表。单击单元格时,视图将导航到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,并选择了File for Owner for Delegate和Data Source。但是当ViewDidLoad方法在SecondViewController中结束时,应用程序崩溃说:

  

收到信号:SIGABRT

在第二行:

int main(int argc, char *argv[])
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}

我应该采取哪些措施来防止此崩溃并让视图加载uipickerview?

编辑:

当我从Interface Builder中删除UIPickerView时,应用程序正常运行。我想我把UIPickerView放在UIView中有一些问题,但我无法处理,因为新手很难.s

1 个答案:

答案 0 :(得分:2)

您需要确保已为此对象实现了委托方法。

相关问题