Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for index in 0..<catalogs.count {
- print("\(index).\(catalogs[index].name)")
- let catalogScrollView = UIScrollView()
- let catalogContainerView = UIView()
- catalogScrollView.showsHorizontalScrollIndicator = false
- catalogScrollView.showsVerticalScrollIndicator = false
- catalogScrollView.bounces = false // 滑動超過單張圖範圍時是否使用彈回效果
- catalogScrollView.delegate = self
- // TODO: For test color
- catalogScrollView.backgroundColor = .gray
- self.scrollView.addSubview(catalogScrollView)
- catalogScrollView.snp.makeConstraints { (makes) in
- makes.left.right.equalToSuperview()
- if index == 0 {
- makes.top.equalTo(self.pageScrollView.snp.bottom).offset(10)
- }else{
- makes.top.equalTo(self.pageScrollView.snp.bottom).offset( CGFloat(10*(index+1)) + fullScreenSize.width/16*9*CGFloat(index))
- }
- if index == catalogs.count{
- print("set bottom")
- makes.bottom.equalToSuperview().offset(-10)
- }
- makes.height.equalTo(fullScreenSize.width/16*9)
- }
- catalogScrollView.addSubview(catalogContainerView)
- catalogContainerView.snp.makeConstraints { (makes) in
- makes.edges.equalToSuperview()
- makes.height.equalTo(fullScreenSize.width/16*9)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment