Skip to content

Add Item into Views #22

Description

@indrac

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

screen shot 2017-04-03 at 4 20 30 pm

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)
              }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions