我加入我的介紹屏幕在scrollview.So我必須滾動水平only.I已設置限制了滾動(頂部,bottom.leading,結尾)。我已經添加子視圖像以下滾動型自動佈局問題的Xcode 8約束
for i in 0..<self.arrIntro.count{
let view = IntroScreenView.instanceFromNib()
let x = CGFloat(i) * self.scrollIntro.frame.size.width
view.frame = CGRect(x: x, y: 0, width: self.scrollIntro.frame.size.width, height: self.scrollIntro.frame.size.height)
print(view,self.scrollIntro)
view.imgIntro.image = UIImage(named: "image-1")//UIImage(contentsOfFile: self.arrIntro[i]["Link"] as! String)
print(self.arrIntro[i]["Link"] as! String)
self.scrollIntro.addSubview(view)
}
self.scrollIntro.contentSize = CGSize(width: (CGFloat(self.arrIntro.count) * self.scrollIntro.frame.size.width) , height: self.scrollIntro.frame.size.height)
但我的scrollview是垂直滾動一點點。如何避免this.Any自動佈局問題?
你爲什麼不使用'UICollectionView'? – clemens