ฉันมีแอพที่จะมี
- scrollView
- contentView
- chart
- ปุ่ม
- อย่างอื่น
- contentView
ฉันพยายามจำกัดตามที่แสดงด้านล่าง แต่ฉันไม่มีข้อจำกัด และไม่พบสิ่งที่ต้องการ
self.view.addSubview(self.scrollView)
self.scrollView.snp.makeConstraints { (make) in
make.edges.equalTo(self.view)
}
let contentView = UIView()
self.scrollView.addSubview(contentView)
contentView.snp.makeConstraints { (make) in
make.top.bottom.equalTo(self.scrollView)
make.left.right.equalTo(self.view)
}
contentView.addSubview(self.chart)
self.chart.snp.makeConstraints { (make) in
// http://snapkit.io/docs/
make.edges.equalTo(contentView).inset(UIEdgeInsets(top: 30, left: 0, bottom: 50, right: 0))
}
ที่ไหน scrollView = UIScrollView()