Connect outlet of a Cell Prototype in a storyboard

前端 未结 3 1332
傲寒
傲寒 2020-12-02 07:32

I\'m a newbie with the Storyboard and so I have some difficulties...

I have created a TableViewController and I would like to customize the Cell Prototype. In the Ce

3条回答
  •  鱼传尺愫
    2020-12-02 08:24

    Swift 3

    // we are using this if your images are at server.

    // we are getting images from a url.

    // you can set image from your Xcode.

    1. The URL of images are in an array name = thumbnail i.e self.thumbnail[indexPath.row]
    2. on UITableviewCell put a imageView on cell
    3. select UIimageView assign it a tag from storyboard.

      let pictureURL = URL(string: self.thumbnail[indexPath.row])!
      let pictureData = NSData(contentsOf: pictureURL as URL)
      let catPicture = UIImage(data: pictureData as! Data)
      var imageV = UIImageView()
      imageV = cell?.viewWithTag(1) as! UIImageView
      imageV.image = catPicture
      

提交回复
热议问题