UIPickerView 修改必须滚动才修改值的bug
//相应的选择转动
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
if (component == 1) {
hour_start = [hour_array[row] integerValue];
NSInteger row = [pickerView selectedRowInComponent:2];
minute_start = [minute_array[row] integerValue];
} else if (component == 2) {
minute_start = [minute_array[row] integerValue];
NSInteger row = [pickerView selectedRowInComponent:1];
hour_start = [hour_array[row] integerValue];
}
if (selectRow == 0) {
startTime[0] = [NSString stringWithFormat:@"%02d:%02d", hour_start, minute_start];
} else if (selectRow == 1) {
startTime[1] = [NSString stringWithFormat:@"%02d:%02d", hour_start, minute_start];
} else {
startTime[2] = [NSString stringWithFormat:@"%02d:%02d", hour_start, minute_start];
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
if (component == 1) {
hour_start = [hour_array[row] integerValue];
NSInteger row = [pickerView selectedRowInComponent:2];
minute_start = [minute_array[row] integerValue];
} else if (component == 2) {
minute_start = [minute_array[row] integerValue];
NSInteger row = [pickerView selectedRowInComponent:1];
hour_start = [hour_array[row] integerValue];
}
if (selectRow == 0) {
startTime[0] = [NSString stringWithFormat:@"%02d:%02d", hour_start, minute_start];
} else if (selectRow == 1) {
startTime[1] = [NSString stringWithFormat:@"%02d:%02d", hour_start, minute_start];
} else {
startTime[2] = [NSString stringWithFormat:@"%02d:%02d", hour_start, minute_start];
}
}
posted on 2015-12-04 17:03 taiyang2014 阅读(507) 评论(0) 编辑 收藏 举报