I want to make all the contents in my table cell vertical align center.
I want my content to render at the red line
I've tried
via code
func updateTableViewContentInset() {
let viewHeight: CGFloat = view.frame.size.height
let tableViewContentHeight: CGFloat = placesTable.contentSize.height
let marginHeight: CGFloat = (viewHeight - tableViewContentHeight) / 2.0
self.placesTable.contentInset = UIEdgeInsets(top: marginHeight, left: 0, bottom: -marginHeight, right: 0)
}
override func viewWillAppear(_ animated: Bool) {
updateTableViewContentInset()
}
I tried
I got
result
or even via the storyboard, but have not get the desired result that I am looking for yet.
Any hints for me ?
Firstly select the two elements in left and add them in vertical stack view like this:
Then select the elements that you want to center inside your cell and apply Vertically in container.
For horizontal constraints between elements, select each element and add constraints like this: