title: UIImageView size is bigger than the frame set inside Table View
body: <p>I have a tableview, which has a header of profileView.</p>
  
  <pre><code>lazy var tableView : UITableView = {
      let tv = UITableView()
      tv.delegate = self
      tv.translatesAutoresizingMaskIntoConstraints = false
      tv.tableHeaderView = self.profileView
      tv.dataSource = self
      tv.backgroundColor = .clear
      tv.register(ReviewTableViewCell.self, forCellReuseIdentifier: ReviewTableViewCell.reuseIdentifier)
      tv.separatorStyle = .none
      return tv
  }()
  
  lazy var profileView : UIView = {
      let view = UIView()
      view.translatesAutoresizingMaskIntoConstraints = false
      return view
  }()
  </code></pre>
  
  <p>Inside the profileView/tableview header I have an image named avatarImage.</p>
  
  <pre><code>var avatarImage:UIImageView = {
      let iv = UIImageView()
      iv.translatesAutoresizingMaskIntoConstraints = false
      iv.backgroundColor = .blue
      iv.layer.cornerRadius = 10.0
      iv.layer.borderColor = UIColor.white.cgColor
      iv.layer.borderWidth = 3.0
      iv.contentMode = UIViewContentMode.scaleAspectFit
      return iv
  }()
  
  override func viewWillLayoutSubviews() {
      setupViews()
      setupProfileView()
  
      if let imageURL = selectedStylist?.imageUrl {
          avatarImage.loadImageUsingCacheWithUrlString(imageURL)
      }
  }
  </code></pre>
  
  <p>I give the avatarImage a frame </p>
  
  <pre><code>func setupViews() {
  
      view.addSubview(tableView)
      NSLayoutConstraint.activate([
  
          tableView.topAnchor.constraint(equalTo: self.view.topAnchor),
          tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
          tableView.leftAnchor.constraint(equalTo: self.view.leftAnchor),
          tableView.rightAnchor.constraint(equalTo: self.view.rightAnchor),
      ])
  
      profileView.addSubview(avatarImage)
  
      avatarImage.frame = CGRect(origin: CGPoint(x: view.frame.width/2 - 80/2 ,
                                                 y: yPositionOfAvatarImage),
                                 size: CGSize(width: 80,
                                              height: 80))
  }
  </code></pre>
  
  <p>This is the extension used to load the image from the url to the imageView</p>
  
  <pre><code>let imageCache = NSCache&lt;NSString, UIImage&gt;()
  
  extension UIImageView {
  
  func loadImageUsingCacheWithUrlString(_ urlString: String) {
  
      self.image = nil
  
      //check cache for image first
      if let cachedImage = imageCache.object(forKey: urlString as NSString){
          self.image = cachedImage
          return
      }
  
      //otherwise fire off a new download
      guard let url = URL(string: urlString) else {
          return
      }
      URLSession.shared.dataTask(with: url) {
          data, response, error in
  
          //download hit an error so lets return out
          if error != nil {
  
              return
          }
          DispatchQueue.main.async(execute: {
              if let downloadedImage = UIImage(data: data!) {
                  imageCache.setObject(downloadedImage, forKey: urlString as NSString)
                  self.image = downloadedImage
              }
          })
          }.resume()
     }
  
  }
  </code></pre>
  
  <p>Instead of the image being 80x80 and fitting inside avatarImage, the avatarImage seems to fill the screen and, I believe, be the size of the image fetched rather than the size of the imageView. If the image fetched is 1024*680, the size of the imageView will be 1024*680 rather than 80*80.</p>