UIPickerView で行 1 を無効にしようとしていますが、次のエラーがスローされます
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2147483647 beyond bounds [0 .. 15]'
ここで何がうまくいかなかったのか、誰でも私に提案できますか?ここにコードがあります
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
if ((row > 0)){
NSLog(@"%@",[locationArray objectAtIndex:row]);
if(flag){
appdelegate.selectedLocation = [locationArray objectAtIndex:row];
NSLog(@"%@",appdelegate.selectedLocation);
} else{
appdelegate.selectedLocation = [locationArray objectAtIndex:row];
NSLog(@"%@",appdelegate.selectedLocation);
}
[promptLocation addSubview:tapButton];
[tapButton addTarget:self action:@selector(goToDesireLoc:) forControlEvents:UIControlEventTouchUpInside];
}else{
//Don't do anything if row 0 is chosen.
NSLog(@"do nothing");
}
}