Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRStringPickerView 优化一处逻辑 #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions BRPickerView/StringPickerView/BRStringPickerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ - (void)configDataSource:(id)dataSource defaultSelValue:(id)defaultSelValue {
// 默认滚动的行
[self.pickerView selectRow:row inComponent:i animated:NO];
}
self.selectValueArr = [tempArr copy];
// self.selectValueArr = [tempArr copy];
self.selectValueArr = tempArr; //
}
}

Expand Down Expand Up @@ -237,15 +238,17 @@ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComp
break;
case BRStringPickerComponentMore:
{
NSMutableArray *tempArr = [NSMutableArray array];
for (NSInteger i = 0; i < self.selectValueArr.count; i++) {
if (i == component) {
[tempArr addObject:self.dataSourceArr[component][row]];
} else {
[tempArr addObject:self.selectValueArr[i]];
}
}
self.selectValueArr = tempArr;
// NSMutableArray *tempArr = [NSMutableArray array];
// for (NSInteger i = 0; i < self.selectValueArr.count; i++) {
// if (i == component) {
// [tempArr addObject:self.dataSourceArr[component][row]];
// } else {
// [tempArr addObject:self.selectValueArr[i]];
// }
// }
// self.selectValueArr = tempArr;

self.selectValueArr[component] = self.dataSourceArr[component][row];//直接修改

// 设置是否自动回调
if (self.isAutoSelect) {
Expand Down