0
我正在使用Storyboard創建控件,並在初始化時在self.lblprice lboutlet上收到此錯誤。 致命錯誤:意外發現零而展開的可選值UICollectionViewCell init中的意外錯誤
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initialize()
}
func initialize(){
self.lblPrice.font = UIFont(name: "Avenir", size: 11)
self.imageView.contentMode = UIViewContentMode.ScaleAspectFit
self.imageView.clipsToBounds = true
self.lblBrand.font = UIFont(name:"Avenir-Book", size:15)
self.lblTitle.font = UIFont(name:"Avenir", size:12)
self.activityIndicatorView = DGActivityIndicatorView(type: .BallPulse, tintColor: UIColor.themeColor(), size: 20.0)
self.activityIndicatorView.frame = CGRectMake(0.0, 0.0, 50.0, 50.0)
self.imageView.addSubview(activityIndicatorView)
self.activityIndicatorView.center = self.imageView.center
}
var activityIndicatorView: DGActivityIndicatorView!
@IBOutlet var lblMSRP: UILabel!
@IBOutlet var lblPrice: UILabel!
@IBOutlet var lblTitle: UILabel!
@IBOutlet var lblBrand: UILabel!
@IBOutlet var imageView: UIImageView!
我正在使用Storyboard,而不是筆尖 – user1688346
@ user1688346沒關係,試試我說的... –