addSubview beneath another UIView
Asked Answered
L

3

12

I would like to be able to addSubview beneath another already existing UIView, how can I do that? I haven't been able to find anything on this.

Lavender answered 15/11, 2012 at 17:44 Comment(1)
beneath, as in under (y-axis) or behind (z-axis)?Clinical
T
29

How about the UIView method: insertSubview:belowSubview:.
It's right there in the "Managing the View Hierarchy" section of the UIView docs.

Thirlage answered 15/11, 2012 at 17:48 Comment(0)
D
8

you can use :

[self.view insertSubview:topview belowSubview:buttomView];
Decaffeinate answered 15/11, 2012 at 17:50 Comment(0)
D
2

In Swift:

self.view.insertSubview(newView, belowSubview: yourLabel)
Doubling answered 10/2, 2021 at 17:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.