我向 UIAlertController 添加了选择器视图,但它的触摸不适用于整个选择器,它仅适用于选择器的某些特定部分。请帮我解决这个问题
代码:
if (IS_IOS8_AND_UP) {
UIAlertController * searchActionSheet=[UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
[searchActionSheet.view setBounds:CGRectMake(8, 180, self.viewSize.width, sheetHeight)];
// aView.frame=CGRectMake(100, 100, aView.frame.size.width, aView.frame.size.height);
//yourView represent the view that contains UIPickerView and toolbar
[searchActionSheet.view addSubview:aView]; //[[self topViewController].view addSubview:searchActionSheet.view]; [[self topViewController] presentViewController:searchActionSheet 动画:YES 完成:nil];
}
else
{
_actionSheet = [[UIActionSheet alloc] initWithTitle:paddedSheetTitle delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
[_actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
[_actionSheet addSubview:aView];
[self presentActionSheet:_actionSheet];
_actionSheet.bounds = CGRectMake(0, 0, self.viewSize.width, sheetHeight);
}
看图片