How to set constraint on stackview

时间:2019-04-17 02:10:13

标签: swift uibutton uistackview

I'm having some button that can move upward and downward in the stack view. However, when I set the stack view constraint, the button move upward then cannot recognise any click.

I have tried to not set the stack view constraint. But the whole stack view will on the top of the screen.

@IBAction func cardButton(_ sender: UIButton) {
    print(sender.tag)

    switch sender.tag {
    case 1:
        if clickOrNot == false {
            pockerButton1.frame.origin.y -= 50
            print(clickOrNot)
        } else {
            pockerButton1.frame.origin.y += 50
        }
        clickOrNot.toggle()
    default:
        break
    }

}

I expect the whole stack view can be constrained and the button sill work fine.

0 个答案:

没有答案