title: UIScrollview constraints for different devices
body: <p>Currently, I have the following codes to make UIScrollView work for iPhone that I have set it up in the main storyboard.</p>
  <pre><code>var images: [String] = [&quot;image1&quot;, &quot;image2&quot;]
  var frame = CGRect(x:0,y:0,width:0,height:0)
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view.
      pageControl.numberOfPages = images.count
      for index in 0..&lt;images.count {
          frame.origin.x = scrollView.frame.size.width * CGFloat(index)
          frame.size = scrollView.frame.size
          
          let imgView = UIImageView(frame: frame)
          imgView.image = UIImage(named: images[index])
          self.scrollView.addSubview(imgView)
      }
      scrollView.contentSize = CGSize(width: (scrollView.frame.size.width * CGFloat(images.count)), height: scrollView.frame.size.height)
      scrollView.delegate = self
  }
  </code></pre>
  <p>I am trying to make a horizontal scrollview in xcode but when I run the project on iPad, the scrollview changes to the screen size but not the images. I looked up solutions online by adding views to the scroll view but it does not work. I am trying to make the images resize accordingly to the scrollview size.</p>
  <p>Quick fact: Images are stored in Assets.xcassets.</p>
  <p>Any help would be very much appreciated. Thanks!</p>