I can't really understand why I am getting this error when I call a function on a subclass of UILabel. I have in AppDelegate
class CascadingLabel: UILabel {
func cascade(){
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.alpha = 1
}
}
func initializeText(){
print("[OUT21] Init")
}
}
In ViewController,
@IBOutlet weak var Intro1: CascadingLabel!
func initializeText(){
Intro1.initializeText() //Here I am getting error!
}
override func viewDidLoad() {
super.viewDidLoad()
print("[OUT21] OpeningScreen opened")
initializeText()
}
The app crashes, yielding error:
Thread 1: EXC_BAD_ACCESS (code=2, address=0x1b3900ec8)
UPDATE ANSWER: Thanks to @ChristianAbella for the answer here. I didn't indicate the class in the Storyboard.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.