zoukankan      html  css  js  c++  java
  • Class 'ViewCell' has no initializers

    Class 'ViewCell' has no initializers

    all variables must have an initialized value in Swift except Optional.

    import UIKit

     

    class InterestCollectionViewCell: UICollectionViewCell {

        

        @IBOutlet weak var tuPian: UIImageView!

        

        @IBOutlet weak var wenZi: UILabel!

        

        var interet: Interest! {// 如果不确定是否有值,用?

            didSet {

                updateUI()

            }

        }

        

        fileprivate func updateUI() {

            self.tuPian?.image! = interet.featuredImage

            self.wenZi?.text! = interet.title

        }

        

        override func layoutSubviews() {

            super.layoutSubviews()

            

            self.layer.cornerRadius = 5.0

            self.clipsToBounds = true

            

        }

     

    }

  • 相关阅读:
    python的基础爬虫(利用requests和bs4)
    R语言时间序列中的时间设置
    PHP扩展开发(6)
    PHP扩展开发(5)
    kafka安装及Kafka-PHP扩展的使用
    brew 更换国内源(镜像)
    PHP扩展开发(4)
    PHP扩展开发(3)-config.m4
    PHP扩展开发(2)
    PHP扩展开发(1)-创建基础框架
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7016919.html
Copyright © 2011-2022 走看看