Bhuwan Sharma
Bhuwan Sharma

Reputation: 269

Programmatically send to front UIButton in custom created view in swift

How to send UIButton to front programmatically. Where I have drag and drop UIButton at storyboard UIView and I have created another custom UIView to display another view after button action is fire.

Upvotes: 2

Views: 1437

Answers (1)

Want Query
Want Query

Reputation: 1426

There are a number of methods of UIView that allow you to modify the view hierarchy.

bringSubviewToFront:
sendSubviewToBack:
insertSubview:atIndex:
insertSubview:aboveSubview:
insertSubview:belowSubview:
exchangeSubviewAtIndex:withSubviewAtIndex:

Since your views are already inserted into your superview, you could easily call bringSubviewToFront: once for each view in whatever order you like.

Upvotes: 2

Related Questions