Add Item into Views
I try to customize my views inside horizontalScrollView, but the item only appear on once, not completely iterate. Look like this :

I used this code :
if indexPath.row == 0 {
horizontalScrollView.uniformItemSize = CGSize(width: 80, height: 60)
horizontalScrollView.setItemsMarginOnce()
for _ in 1...20{
let imageView = UIImageView(frame: CGRect.zero)
imageView.image = UIImage(named: "cetakidcard")
imageView.contentMode = .scaleAspectFill
let viewSome = UIView()
viewSome.backgroundColor = UIColor.black
let produkLabel = UILabel()
produkLabel.text = "Software Antrian"
let produkImage = UIImageView()
produkImage.image = UIImage(named: "cetakidcard")
produkImage.contentMode = .scaleAspectFill
produkImage.snp.makeConstraints { make in
make.height.equalTo(50)
make.width.equalTo(50)
}
viewSome.addSubview(produkImage)
horizontalScrollView.addItem(viewSome)
}
}
I guess this issue relates to the constraints you add to your product image view. What does makeConstraints exactly do except adding height and width constraints? I suggest you can check the frame of each item after viewDidAppear
Have you tried the horizontalScrollView.addItem() to your custom views?? Because it didn't work.
@indrac it works well for me, the screenshots in Readme is from my personal app. I guess you didn't add enough constraints for your image view, as I can see, you only add width and height constraint, you will also need the position constraints for it.
And you also add constraints before adding it to super view, which is wrong. You should add your produkImage to viewSome first and then add constraints with translatesAutoresizingMaskIntoConstraints off for your produkImage