首页 > 代码库 > Class 'ViewCell' has no initializers
Class 'ViewCell' has no initializers
Class ‘ViewCell‘ has no initializers
all variables must have an initialized value in Swift except Optional.
<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; min-height: 16.0px } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ba2da2 } p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #4f8187 } p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #3e1e81 } p.p6 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #703daa } span.s1 { color: #ba2da2 } span.s2 { } span.s3 { color: #703daa } span.s4 { color: #000000 } span.s5 { color: #4f8187 } span.s6 { color: #31595d } span.s7 { color: #272ad8 }</style>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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。