次のコードを確認してください。なぜUILabel()はnilを返しますか?
fatal error: unexpectedly found nil while unwrapping an Optional value
UILabelは()nil
を返す理由をすべてのアイデア:次のエラーでself.title.textColor = .white
で
class MyViewCell: UICollectionViewCell {
@IBOutlet weak var title: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
didLoad()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
didLoad()
}
/// Common init code.
func didLoad() {
self.title = UILabel()
self.title.textColor = .white
...
}
}
マイアプリのクラッシュ?
この行を必要といけないことを確認してください。私の悪い。私は疲れていなければならない。ありがとうたくさん:) –