我正在尝试在我的应用程序中使用内联PickerView,除了一件事情它工作正常。当我尝试根据数据参数将选择器的行设置为特定的行时,我的应用程序崩溃。
UITableViewCell *associatedTypePickerCell = [self.tableView cellForRowAtIndexPath:self.datePickerIndexPath];
UIPickerView *targetedPickerView = (UIPickerView *)[associatedTypePickerCell viewWithTag:kTypePickerTag];
if (targetedPickerView != nil){
NSLog(@"type picker ! = nil");
NSDictionary *itemData = self.dataArray[self.datePickerIndexPath.row-1];
Type *type = [itemData valueForKey:kDateKey];
NSInteger row = [[self types] indexOfObject:type];
[targetedPickerView selectRow:row inComponent:0 animated:NO];
}
我收到此错误:
-[UITableViewCell selectRow:inComponent:animated:]: unrecognized selector sent to instance 0x8ecba70
2014-07-22 23:47:23.384 MyGIJournal[16636:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell selectRow:inComponent:animated:]: unrecognized selector sent to instance 0x8ecba70'
有谁知道为什么会崩溃?看起来像这样的UIPickerView无法正常工作,这没有多大意义,因为这与我为UIDatePicker做的完全相同,并且它适用于...任何帮助或建议将不胜感激,谢谢!