Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place any view below any other view which is getting it's position from code

I've created 4 subviews of white color & a yellow one as you can see in reference image I've shared below.

enter image description here

And I've programmatically changed the position of Tabbar from bottom to top just below to navigation bar as you can see in below image (When it is running in the simulator).

enter image description here

Now since I've constraints for that yellow view in image as follow

enter image description here

It is appearing just below to navigation bar but I want it to be displayed just below the Tabbar.

Since Tabbar is getting its position programmatically & other views (including yellow view) are getting their positions from the storyboard. And since storyboard UIelements are get settled before any other UIelement which are coming from the program or at least get their position from programmatically.

What could be the best way to achieve what I want.

Please refer my storyboard as well to get more understanding. (Refer Below image) enter image description here

I also want to fit all 5 subviews in the space between tabbar & bottom of the screen. I want to calculate 1/5th of that space & assign this height to each subview. I'd later reduce few pixels to separate them.

like image 643
Rais Iqbal Avatar asked Mar 20 '17 08:03

Rais Iqbal


1 Answers

Why not add the height of the tab bar to the yellow view's top position? That way, you'd set the constraint something like:

Fajar.top = top + 44

If the tab bar is always visible, then that should work. But of course, if the tab bar only appears at times, you'd probably have to change that constraint programmatically depending on the change ...

like image 154
Fahim Avatar answered Oct 19 '22 22:10

Fahim