Created
September 15, 2017 00:44
-
-
Save farhan-syed/95662f0e384a06fe0fc83ddb1bb874a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setupImages(_ images: [UIImage]){ | |
for i in 0..<images.count { | |
let imageView = UIImageView() | |
imageView.image = images[i] | |
let xPosition = UIScreen.main.bounds.width * CGFloat(i) | |
imageView.frame = CGRect(x: xPosition, y: 0, width: scrollView.frame.width, height: scrollView.frame.height) | |
imageView.contentMode = .scaleAspectFit | |
scrollView.contentSize.width = scrollView.frame.width * CGFloat(i + 1) | |
scrollView.addSubview(imageView) | |
scrollView.delegate = self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment