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

            

        }

     

    }

  • 相关阅读:
    基于HTML5技术的电力3D监控应用(三)
    XCODE 出现 The operation couldn't be completed.(LaunchServicesError error 0.)错误修复
    iOS本地动态验证码生成-b
    裁剪出环形图片
    UITableView实现格瓦拉飞天投票模块-b
    高仿猫眼电影选座(选票)模块-b
    java和php实现RSA加密互通-b
    iOS10 权限崩溃问题-b
    iOS百度地图路径规划和POI检索详细总结-b
    iOS 的 Gif 渲染
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7016919.html
Copyright © 2011-2022 走看看