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

ios,picker点击取消按钮后再次打开picker会导致无法显示数据,附解决办法。 #439

Open
swb2016 opened this issue Mar 24, 2023 · 0 comments

Comments

@swb2016
Copy link

swb2016 commented Mar 24, 2023

iOS系统,调用Picker.init方法初始化后,点击选择可以正常打开选择框。当点击取消按钮后,再次点击选择打开选择框,选择框内无法显示数据。此问题在Android系统中不存在,经过检查插件源码发现,点击取消按钮的逻辑与点击确定按钮的逻辑相似,但取消按钮的逻辑最下方多出一行代码

self.pick.hidden=YES;

该行代码位置在BzwPicker.m文件的cancleAction方法中,位于该方法逻辑的最后一行。
注释掉此行代码后,iOS的取消选择逻辑就正常了,取消选择后再次打开Picker也可以显示数据了。

完整修改:

//按了取消按钮
-(void)cancleAction
{
    NSMutableDictionary *dic=[[NSMutableDictionary alloc]init];
    
    if (self.backArry.count>0) {
        [dic setValue:self.backArry forKey:@"selectedValue"];
        [dic setValue:@"cancel" forKey:@"type"];
        
        [dic setValue:[self getselectIndexArry] forKey:@"selectedIndex"];
        
        self.bolock(dic);
    }else{
        [self getNOselectinfo];
        
        [dic setValue:self.backArry forKey:@"selectedValue"];
        [dic setValue:@"cancel" forKey:@"type"];
        [dic setValue:[self getselectIndexArry] forKey:@"selectedIndex"];
        self.bolock(dic);
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        [UIView animateWithDuration:.2f animations:^{
            
            [self setFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 250)];
            
        }];
    });

//    self.pick.hidden=YES; //注释此行代码,否则点击取消按钮后再次打开Picker会导致没有数据
}

该解决办法仅供参考。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant