在ios6的uipickerview中选择组件1中的行时崩溃

问题描述:

我有一个工作正常的应用程序,直到ios5.1。但是最近使用ios6时,我尝试以编程方式选择组件中的某一行时,它开始崩溃。以下是我的代码:在ios6的uipickerview中选择组件1中的行时崩溃

UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 320, 216)]; 
pickerView.delegate=self; 
pickerView.dataSource=self; 
pickerView.showsSelectionIndicator=YES; 
[pickerView setTag:10]; 
//[pickerView selectRow:0 inComponent:0 animated:YES]; 
int index1 = [arrHours indexOfObject:[arrTitle objectAtIndex:0]]; 
int index2 = [arrMins indexOfObject:[arrTitle objectAtIndex:1]]; 

[actionSheet addSubview:pickerView]; 
[pickerView selectRow:index1 inComponent:0 animated:YES]; 
[pickerView selectRow:index2 inComponent:1 animated:YES]; 
[pickerView release]; 

,当我尝试在组件0来选择行,但我得到的崩溃,当我尝试在组件1

选择行有人可以帮我运行正常?

问候 潘卡

+0

尝试打印数组.check如果datasource数组为null或不是? – AppleDelegate

+0

是检查数据帮助我。我已经添加了我的答案。 – pankaj

确定发现的调试错误。问题是因为数据中有00。早期的框架本身将它转换为0,但在新的sdk(ios6)中,当我将00视为0时,它开始产生错误。