I need to implement AutoLayout
in my layout. Below are some screenshots:
1.
2.
The case is :
I have a ShinobiDataGrid in View
and a UITableView
. First image is first condition, in first picture I want the view
have height as height View Controller
.
The second and third picture is when there are available TableView
. I want the TableView
always is at the bottom of View Controller
and the View
is have height depends of height Table View
.
I read this, this and all of reference on that but it's not working for me.
I read some article about Auto Layout and I get this below:
1.
2.
But in first picture, the the UIView
still have a distance with main View. I want it only have 3 or 4 point from bottom of main View like below:
Now, I have one constrain from UIView to the UITableView. I add one constrain from UIView to bottom main View with custom priority, constant and etc but it's not working.
1.I would suggest you to use UITableView with section header and footers , with no scroll. Add your views to UITableViewCell. Populate your UITableView with custom cells based on your requirements.
2.You can also use UIStackView for the same. Add all your views & table views to a vertical stack view in Interface Builder. Keep distribution as fill equally. First time hide your UITableView. Your view will cover complete then show / hide tableview when required and update stack view. Constraint your views & table views with respect to stack view. UIStackView manages autolayout.
3.I would have used UITableViewController with static cells (with no scroll) with views and tableviews as subview of static UITableViewCells. First time in heightFoRowAtIndexPath pass complete height. When tableview will be visible. Reload tableview controller and pass height accordingly.
Instead of using UITableView inside cell. I would suggest using UIStackView as subview cell. Show your data in UIStackView.