问题描述
我在 UIView 中放置了一个 UIPickerView。在我这样做之前,选择器工作正常,但现在不再响应触摸。看起来触摸是直接通过 UIView 和 UIPickerView 子视图进行的,因为我仍然可以滚动背景。
我正在像这样设置我的视图和 PickerView 子视图,从 viewDidLoad 调用:
- (void)setupMapClusterPicker {
UIView *pickerView = [[UIView alloc] initWithFrame:self.view.frame];
pickerView.translatesAutoresizingMaskIntoConstraints = false;
[pickerView setUserInteractionEnabled:YES];
_mapClusterPicker = [UIPickerView new];
_mapClusterPicker.delegate = self;
_mapClusterPicker.dataSource = self;
_mapClusterPicker.showsSelectionIndicator = YES;
_mapClusterPicker.backgroundColor = [UIColor whiteColor];
_mapClusterPicker.translatesAutoresizingMaskIntoConstraints = false;
_mapClusterPicker.hidden = YES;
[pickerView addSubview:_mapClusterPicker];
[self.view addSubview:pickerView];
[pickerView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor].active = YES;
[pickerView.widthAnchor constraintEqualToAnchor:self.view.widthAnchor].active = YES;
[_mapClusterPicker.bottomAnchor constraintEqualToAnchor:pickerView.bottomAnchor].active = YES;
[_mapClusterPicker.widthAnchor constraintEqualToAnchor:pickerView.widthAnchor].active = YES;
}
希望有人能帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)