首页 > 其他 > 详细

Class 'ViewCell' has no initializers

时间:2017-06-15 13:51:55      阅读:574      评论:0      收藏:0      [点我收藏+]

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

        

    }

 

}

Class 'ViewCell' has no initializers

原文:http://www.cnblogs.com/dengchaojie/p/7016919.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!