gpt4 book ai didi

iphone - UIPickerView 导致应用程序崩溃

转载 作者:行者123 更新时间:2023-12-03 21:07:10 28 4
gpt4 key购买 nike

我有两种看法。第一个:第一个 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com