键盘上方的工具栏未显示 - iOS 11

aqs*_*had 3 iphone objective-c ios ios11

键盘上方的工具栏未显示在iOS 11.0上.它在<11.0版本上运行良好.

这是我添加工具栏的代码.那么我应该添加到iOS 11.0上显示它:

UIToolbar* customToolBar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60)];     
        customToolBar.barStyle = UIBarStyleDefault;
        customToolBar.items = [NSArray arrayWithObjects:
              [[UIBarButtonItem alloc] initWithTitle:@"+ Contact" 
                                    style:UIBarButtonItemStylePlain 
                                    target:self 
                                    action:@selector(showPicker:)],
               [[UIBarButtonItem 
          alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
               target:nil 
               action:nil],
              [[UIBarButtonItem alloc] initWithTitle:@"- Contact" 
                                     style:UIBarButtonItemStylePlain 
                                    target:self 
                                    action:@selector(HidePicker:)],
                               nil];
        [customToolBar sizeToFit];
        self.textView.inputAccessoryView=customToolBar;
Run Code Online (Sandbox Code Playgroud)

Son*_*sas 9

在iOS 11测试版中,在不使用默认键盘时显示工具栏存在问题(例如,datepicker,值选择器).这可以通过将以下行添加到pickerView来解决:pickerView.translatesAutoresizingMaskIntoConstraints = false