Quantcast
Channel: Active questions tagged uipickerview - Stack Overflow
Viewing all articles
Browse latest Browse all 592

Adding a UIBarButtonItem to my UIPickerView is throwing me a constraint error

$
0
0

I only see this error when I add the barButtonItem "Done" button to my UIPickerView. Here is the error that I'm seeing. What am I doing wrong?

func PickerToolBar(){
        let toolBar = UIToolbar()
        toolBar.barStyle = .default
        toolBar.sizeToFit()

        let doneButton = UIBarButtonItem(title: "Done", style: .plain, target: self, action: #selector(timeClock))
        toolBar.setItems([doneButton], animated: false)

        timerTextField.inputView = timePicker
        timerTextField.inputAccessoryView = toolBar

    }

-

2020-02-11 21:53:31.971518-0500 SectionRowsTutorial[15418:1243896] [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:0x60000020a300 h=--& v=--& _UIToolbarContentView:0x7f8513786a10.width == 0   (active)>",
        "<NSLayoutConstraint:0x60000026f430 H:|-(0)-[_UIButtonBarStackView:0x7f85137871b0]   (active, names: '|':_UIToolbarContentView:0x7f8513786a10 )>",
        "<NSLayoutConstraint:0x60000026f480 _UIButtonBarStackView:0x7f85137871b0.trailing == _UIToolbarContentView:0x7f8513786a10.trailing   (active)>",
        "<NSLayoutConstraint:0x600000209720 'TB_Leading_Leading' H:|-(20)-[_UIModernBarButton:0x7f8513666a50'Done']   (active, names: '|':_UIButtonBarButton:0x7f8513666870 )>",
        "<NSLayoutConstraint:0x600000209770 'TB_Trailing_Trailing' H:[_UIModernBarButton:0x7f8513666a50'Done']-(20)-|   (active, names: '|':_UIButtonBarButton:0x7f8513666870 )>",
        "<NSLayoutConstraint:0x600000209c70 'UISV-canvas-connection' UILayoutGuide:0x6000018ac1c0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x7f8513666870.leading   (active)>",
        "<NSLayoutConstraint:0x600000209cc0 'UISV-canvas-connection' UILayoutGuide:0x6000018ac1c0'UIViewLayoutMarginsGuide'.trailing == UIView:0x7f85136672b0.trailing   (active)>",
        "<NSLayoutConstraint:0x600000209d10 'UISV-spacing' H:[_UIButtonBarButton:0x7f8513666870]-(0)-[UIView:0x7f85136672b0]   (active)>",
        "<NSLayoutConstraint:0x60000026f2a0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x6000018ac1c0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x7f85137871b0 )>",
        "<NSLayoutConstraint:0x60000026f340 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000018ac1c0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x7f85137871b0 )>"
    )

    Will attempt to recover by breaking constraint 
    <NSLayoutConstraint:0x600000209770 'TB_Trailing_Trailing' H:[_UIModernBarButton:0x7f8513666a50'Done']-(20)-|   (active, names: '|':_UIButtonBarButton:0x7f8513666870 )>

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>