This is my class of a UIView:
class overlap: UIView{
init() {
super.init(frame: UIScreen.main.bounds)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
fatalError("init(coder:) has not been implemented")
}
}
It should just fill up the screen. When I add the view in Storyboard with constraints pinned to the edges of the screen, it crashes when I launch the app. The error comes up as stated in the code above.
Creating and adding the subclass programmatically works with this init function:
override init(frame: CGRect) {
super.init(frame: frame)
}
But I want it reusable through Storyboard, without adding code. What is wrong with my code, and is it even possible what I want?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…