Reputation: 4247
I want to add mapView, which I'm adding programatically, to the bottom of hierarchy view, as I already draw some of the elements beforehand, in the storyboard.
So, after i call method:
[self.view addSubview:self.map];
How do I put it on the bottom of the view hierarchy ?!
Upvotes: 19
Views: 15378
Reputation: 1103
Answer by Robert and rcat24 does work. Alternatively,
You can use "zPosition"
subViewToBeOnTop.layer.zPosition=1.0;
subViewToBeOnBottom.layer.zPosition=.9;
1 being top most, 0 being least.
Upvotes: 2
Reputation: 5666
Just put it there directly instead.
[self.view insertSubview:_map atIndex:0];
Upvotes: 30
Reputation: 538
"This method moves the specified view to the beginning of the array of views in the subviews property."
[self.view sendSubviewToBack:yourView];
Upvotes: 11