title: Images not showing in scroll view (only code, no storyboard)
body: <p><a href="https://i.stack.imgur.com/njEN0.jpg" rel="nofollow noreferrer">What I want to create</a>Ive searched myself around without any answers. First of all I'm not using storyboards (found very simply solutions for that with my problem)</p>
  
  <p>Im using a UIscrollview and Pagecontrol to create something like this just to be as clear as possible.</p>
  
  <p>when I load my app, the uiscrollview and page panel (set to black color) is showing, so its nothing wrong with the normal constrains.</p>
  
  <p>However I'm not able to load my images and neither can I see the small round buttons showing which "page" I'm on.</p>
  
  <p>here is the most important code concerning this:</p>
  
  <pre><code>class ViewController: UIViewController, UIScrollViewDelegate {
  var images: [String] = ["0.jpg", "1.jpg"]
  var frame = CGRect(x: 0, y: 0, width: 0, height: 0)
  
   lazy var scrollView: UIScrollView = {
      let scroll = UIScrollView()
      scroll.backgroundColor = UIColor.black
      scroll.translatesAutoresizingMaskIntoConstraints = false
      scroll.layer.cornerRadius = 30
      return scroll
  
  }()
  
  lazy var pageControl: UIPageControl = {
      let page = UIPageControl()
      page.backgroundColor = UIColor.black
      page.translatesAutoresizingMaskIntoConstraints = false
      return page
  }()
  </code></pre>
  
  <p>the methods:</p>
  
  <pre><code>func testScroll() {
      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
  }
  
  func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
      var pageNumber = scrollView.contentOffset.x / scrollView.frame.size.width
      pageControl.currentPage = Int(pageNumber)
  }
  </code></pre>