• 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

            

        }

     

    }

  • 相关阅读:
    掌上风云
    骗子太多傻子不够用了
    关于WP7的一点想法
    诺基亚的抉择
    Windows Embedded Compact 7 试用笔记(3)
    Windows Embedded Compact 试用笔记(2)——系统定制
    重开博客
    结构体的嵌套问题
    Delphi 2010 新增功能之: IOUtils 单元(1): 初识 TDirectory.GetFiles
    TImage、TPaintBox、TPicture、TBitmap、TCanvas、TGraphic 的关系与区别
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7016919.html
Copyright © 2020-2023  润新知