这是我的结构:
-View
-scrollview
-view
-stackview //main stackview
-stackview1
-label1
-label2
-stackview2
-label1
-label2
-stackview3
-label1
-label2
-stackview4
-label1
-label2
-stackview5 // this is the dynamic vertical stackview
-label1
-label2 //this is the dynamic label
-stackview6
-label1
-label2
我希望基于stackview5的scrollview是动态的。我将stackview5中的label2设置为0行。我还将分布设置为相等的间距。我还缺少什么?
答案 0 :(得分:0)
I would use a UITableView
each of you six stackviews would be their own tableViewCell
Add this to the view did load of you TableViewController
self.tableView.estimatedRowHeight = 58.0 // whatever you want your default to be
self.tableView.rowHeight = UITableViewAutomaticDimension
add also this method to your TableViewController
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}