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

            

        }

     

    }

  • 相关阅读:
    空余时间
    日期的获取
    checkbox的样式
    表格
    v-for的一些小demo
    进程在与Windows Process Activation Service通信时出现严重错误 w3wp.exe错误
    c# 一些DateTime.Now的常用语法
    wcf错误 无法激活服务,因为它不支持 ASP.NET 兼容性
    c# 未能加载文件或程序集 相关原因
    IIS配置使网站访问速度提升
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7016919.html
Copyright © 2011-2022 走看看