在我的按钮单击应用程序中,我将pickerview添加到下面的窗口中是代码显示
- (IBAction)btnMake:(id)sender
{
pickerViewMake = [[UIPickerView alloc] initWithFrame:pickerFrame];
pickerViewMake.showsSelectionIndicator = YES;
pickerViewMake.dataSource = self;
pickerViewMake.delegate = self;
[pickerViewMake setBackgroundColor:[UIColor clearColor]];
[viewPicker addSubview:pickerViewMake];
[self.view.window addSubview:pickerViewMake];
}
-(void)removeAllPicker
{
[pickerViewMake removeFromSuperview];
[pickerViewModel removeFromSuperview];
[pickerViewYear removeFromSuperview];
[pickerViewTrim removeFromSuperview];
}
删除所有选择器是用于从超级视图中删除选择器的方法,它可以工作问题是,在多次单击 btnMake 时,选择器视图的锥体数向上然后 removeallPicker 方法调用,而不是选择器视图不会从超级视图中删除。