When I click on of the five textfield, the picker view comes up but this error comes up. when you click on the lower two textfields the picker view doesn't´t come up. If I make this whole thing inside a scroll view the lower textfields work also with the picker view. I couldn't´t find anything how to fix this qwq all the stuff in the view controller ist autoresized.
image of the storyboard: https://imgur.com/a/9gYud1D
Code:
import UIKitimport Chartsimport CoreDataclass ExamViewController: TabView, ChartViewDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UITextFieldDelegate { @IBOutlet weak var block1Label: UILabel! @IBOutlet weak var block2Label: UILabel! @IBOutlet weak var P1Field: UITextField! @IBOutlet weak var P1Points: UITextField! @IBOutlet weak var P2Field: UITextField! @IBOutlet weak var P2Points: UITextField! @IBOutlet weak var P3Field: UITextField! @IBOutlet weak var P3Points: UITextField! @IBOutlet weak var P4Field: UITextField! @IBOutlet weak var P4Points: UITextField! @IBOutlet weak var P5Field: UITextField! @IBOutlet weak var P5Points: UITextField! @IBOutlet weak var scrollView: UIScrollView! var strCurrentFieldEditing: String = "" var picks: [String] = [] var numberPicks: [String] = [ "0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"] let subjectPicker = UIPickerView() let numberPicker = UIPickerView() let toolBar = UIToolbar() let notificationAlert = UIAlertController(title: "qwq", message: "qwq#2", preferredStyle: .alert) override func viewDidLoad() { super.viewDidLoad(); update() subjectPicker.delegate = self numberPicker.delegate = self P1Field.delegate = self P2Field.delegate = self P3Field.delegate = self P4Field.delegate = self P5Field.delegate = self P1Field.inputView = subjectPicker P1Field.inputAccessoryView = toolBar P2Field.inputView = subjectPicker P2Field.inputAccessoryView = toolBar P3Field.inputView = subjectPicker P3Field.inputAccessoryView = toolBar P4Field.inputView = subjectPicker P4Field.inputAccessoryView = toolBar P5Field.inputView = subjectPicker P5Field.inputAccessoryView = toolBar self.navigationItem.title = "Prüfungsübersicht" notificationAlert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil)) scrollView.contentSize = CGSize( width: scrollView.visibleSize.width, height: scrollView.visibleSize.height*1.1 ) } func pickUp(_ textField : UITextField){ toolBar.barStyle = .default toolBar.isTranslucent = true toolBar.tintColor = UIColor.accentColor toolBar.sizeToFit() let doneButton = UIBarButtonItem(title: "Done", style: .plain, target: self, action: #selector(ExamViewController.donePicker)) let spaceButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) let cancelButton = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(ExamViewController.cancelPicker)) toolBar.setItems([cancelButton, spaceButton, doneButton], animated: false) toolBar.isUserInteractionEnabled = true } @objc func donePicker() { if(strCurrentFieldEditing == "P1"){ P1Field.resignFirstResponder() }else if(strCurrentFieldEditing == "P2"){ P2Field.resignFirstResponder() }else if(strCurrentFieldEditing == "P3"){ P3Field.resignFirstResponder() }else if(strCurrentFieldEditing == "P4"){ P4Field.resignFirstResponder() }else if(strCurrentFieldEditing == "P5"){ P5Field.resignFirstResponder() } update() } @objc func cancelPicker(){ if(strCurrentFieldEditing == "P1"){ P1Field.resignFirstResponder() P1Points.text = nil }else if(strCurrentFieldEditing == "P2"){ P2Field.resignFirstResponder() P2Points.text = nil }else if(strCurrentFieldEditing == "P3"){ P3Field.resignFirstResponder() P3Points.text = nil }else if(strCurrentFieldEditing == "P4"){ P4Field.resignFirstResponder() P4Points.text = nil }else if(strCurrentFieldEditing == "P5"){ P5Field.resignFirstResponder() P5Points.text = nil } } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated); update() } // MARK: UIPickerView Delegation func numberOfComponents(in pickerView: UIPickerView) -> Int { return 2 } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { if(component == 0){ return picks.count }else { return numberPicks.count } } func pickerView( _ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { if(component == 0){ return picks[row] }else { return numberPicks[row] } } func pickerView( _ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { if(picks.count == 0) { self.present(self.notificationAlert, animated: true, completion: nil) return } if(component == 0){ if(strCurrentFieldEditing == "P1"){ P1Field.text = picks[row] }else if(strCurrentFieldEditing == "P2"){ P2Field.text = picks[row] }else if(strCurrentFieldEditing == "P3"){ P3Field.text = picks[row] }else if(strCurrentFieldEditing == "P4"){ P4Field.text = picks[row] }else if(strCurrentFieldEditing == "P5"){ P5Field.text = picks[row] } }else { if(strCurrentFieldEditing == "P1"){ P1Points.text = numberPicks[row] }else if(strCurrentFieldEditing == "P2"){ P2Points.text = numberPicks[row] }else if(strCurrentFieldEditing == "P3"){ P3Points.text = numberPicks[row] }else if(strCurrentFieldEditing == "P4"){ P4Points.text = numberPicks[row] }else if(strCurrentFieldEditing == "P5"){ P5Points.text = numberPicks[row] } } } func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { if(picks.count == 0){ return false} if(textField == P1Field){ self.strCurrentFieldEditing = "P1" }else if(textField == P2Field){ self.strCurrentFieldEditing = "P2" }else if(textField == P3Field){ self.strCurrentFieldEditing = "P3" }else if(textField == P4Field){ self.strCurrentFieldEditing = "P4" }else if(textField == P5Field){ self.strCurrentFieldEditing = "P5" } self.pickUp(textField) return true } func update() { picks = Util.getAllSubjectNames() if((picks.firstIndex(of: P1Field.text ?? "")) != nil){ picks.remove(at: picks.firstIndex(of: P1Field.text ?? "")!) } if((picks.firstIndex(of: P2Field.text ?? "")) != nil){ picks.remove(at: picks.firstIndex(of: P2Field.text ?? "")!) } if((picks.firstIndex(of: P3Field.text ?? "")) != nil){ picks.remove(at: picks.firstIndex(of: P3Field.text ?? "")!) } if((picks.firstIndex(of: P4Field.text ?? "")) != nil){ picks.remove(at: picks.firstIndex(of: P4Field.text ?? "")!) } if((picks.firstIndex(of: P5Field.text ?? "")) != nil){ picks.remove(at: picks.firstIndex(of: P5Field.text ?? "")!) } } }}
So this my error
2021-10-29 15:16:32.284195+0200 Calq[3986:101986] Writing analzed variants.objc[3986]: Class _PathPoint is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x118606a78) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x136e958b0). One of the two will be used. Which one is undefined.objc[3986]: Class _PointQueue is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x118606a50) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x136e958d8). One of the two will be used. Which one is undefined.2021-10-29 15:16:32.594144+0200 Calq[3986:101986] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ("<NSAutoresizingMaskLayoutConstraint:0x6000012f0960 h=--& v=--& _UIToolbarContentView:0x7f8620b429e0.width == 0 (active)>","<NSLayoutConstraint:0x6000012e0730 H:|-(0)-[_UIButtonBarStackView:0x7f8620b43290] (active, names: '|':_UIToolbarContentView:0x7f8620b429e0 )>","<NSLayoutConstraint:0x6000012e0780 H:[_UIButtonBarStackView:0x7f8620b43290]-(0)-| (active, names: '|':_UIToolbarContentView:0x7f8620b429e0 )>","<NSLayoutConstraint:0x6000012fb6b0 'TB_Leading_Leading' H:|-(0)-[_UIModernBarButton:0x7f861ff7c3b0'Cancel'] (active, names: '|':_UIButtonBarButton:0x7f861ff7be90 )>","<NSLayoutConstraint:0x6000012fb700 'TB_Trailing_Trailing' H:[_UIModernBarButton:0x7f861ff7c3b0'Cancel']-(8)-| (active, names: '|':_UIButtonBarButton:0x7f861ff7be90 )>","<NSLayoutConstraint:0x6000012f0000 'UISV-canvas-connection' UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x7f861ff7be90.leading (active)>","<NSLayoutConstraint:0x6000012f0230 'UISV-canvas-connection' UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x7f861ff7eb70.trailing (active)>","<NSLayoutConstraint:0x6000012f0280 'UISV-spacing' H:[_UIButtonBarButton:0x7f861ff7be90]-(0)-[UIView:0x7f861ff7ea00] (active)>","<NSLayoutConstraint:0x6000012f02d0 'UISV-spacing' H:[UIView:0x7f861ff7ea00]-(0)-[_UIButtonBarButton:0x7f861ff7eb70] (active)>","<NSLayoutConstraint:0x6000012e0550 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIButtonBarStackView:0x7f8620b43290 )>","<NSLayoutConstraint:0x6000012e05f0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':_UIButtonBarStackView:0x7f8620b43290 )>")Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000012fb700 'TB_Trailing_Trailing' H:[_UIModernBarButton:0x7f861ff7c3b0'Cancel']-(8)-| (active, names: '|':_UIButtonBarButton:0x7f861ff7be90 )>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.2021-10-29 15:16:32.595554+0200 Calq[3986:101986] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ("<NSAutoresizingMaskLayoutConstraint:0x6000012f0960 h=--& v=--& _UIToolbarContentView:0x7f8620b429e0.width == 0 (active)>","<NSLayoutConstraint:0x6000012e0730 H:|-(0)-[_UIButtonBarStackView:0x7f8620b43290] (active, names: '|':_UIToolbarContentView:0x7f8620b429e0 )>","<NSLayoutConstraint:0x6000012e0780 H:[_UIButtonBarStackView:0x7f8620b43290]-(0)-| (active, names: '|':_UIToolbarContentView:0x7f8620b429e0 )>","<NSLayoutConstraint:0x6000012fbca0 'TB_Leading_Leading' H:|-(8)-[_UIModernBarButton:0x7f861ff7ed50'Done'] (active, names: '|':_UIButtonBarButton:0x7f861ff7eb70 )>","<NSLayoutConstraint:0x6000012fbcf0 'TB_Trailing_Trailing' H:[_UIModernBarButton:0x7f861ff7ed50'Done']-(0)-| (active, names: '|':_UIButtonBarButton:0x7f861ff7eb70 )>","<NSLayoutConstraint:0x6000012f0000 'UISV-canvas-connection' UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x7f861ff7be90.leading (active)>","<NSLayoutConstraint:0x6000012f0230 'UISV-canvas-connection' UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x7f861ff7eb70.trailing (active)>","<NSLayoutConstraint:0x6000012f0280 'UISV-spacing' H:[_UIButtonBarButton:0x7f861ff7be90]-(0)-[UIView:0x7f861ff7ea00] (active)>","<NSLayoutConstraint:0x6000012f02d0 'UISV-spacing' H:[UIView:0x7f861ff7ea00]-(0)-[_UIButtonBarButton:0x7f861ff7eb70] (active)>","<NSLayoutConstraint:0x6000012e0550 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIButtonBarStackView:0x7f8620b43290 )>","<NSLayoutConstraint:0x6000012e05f0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000008a3020'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':_UIButtonBarStackView:0x7f8620b43290 )>")Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000012fbcf0 'TB_Trailing_Trailing' H:[_UIModernBarButton:0x7f861ff7ed50'Done']-(0)-| (active, names: '|':_UIButtonBarButton:0x7f861ff7eb70 )>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.```