当component 一直是零的时候,那么 就 修改 row的数值了。。。
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated
{
[super selectRow:row inComponent:component animated:animated];
if (row < 0) {
row = 0;
}
else if (row > [self numberOfRowsInComponent:component]) {
row = [self numberOfRowsInComponent:component] - 1;
}
int lastIndex = [self selectedRowInComponent:component];
if (lastIndex != row) {
PickerCellView* cellView = (PickerCellView*)[self viewForRow:lastIndex forComponent:component];
cellView.selected = NO;
cellView = (PickerCellView*)[self viewForRow:row forComponent:component];
cellView.selected = YES;
}
[self.selectionDicsetValue:[NSNumbernumberWithInt:row] forKey:[NSStringstringWithFormat:@"%d", component]];
}