How can I bring a view in front of another view, in Swift?

前端 未结 5 754
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 10:37

Below are how my views are organized in IB, top->bottom when the app is started.

The user can do something to make \"Category Table View Header\" temporarily expand

5条回答
  •  萌比男神i
    2020-12-16 11:17

    If you want to bring a subview to the front, you can use:

    SWIFT 4 UPDATE

    self.view.bringSubviewToFront(yourView)
    

    SWIFT 3 UPDATE

    self.view.bringSubview(toFront: yourView)
    

    Send view to back:-

    SWIFT 4 UPDATE

    self.view.sendSubviewToBack(yourView)
    

    SWIFT 3 UPDATE

    self.view.sendSubview(toBack: yourView)
    

提交回复
热议问题