lexrus / LTMorphingLabel

[EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift.
MIT License
8.07k stars 782 forks source link

fatal error: unexpectedly found nil while unwrapping an Optional value #10

Closed zzndino closed 10 years ago

zzndino commented 10 years ago

My code like below :

    var label89val: LTMorphingLabel!
    label89val = LTMorphingLabel(frame: CGRectMake(20, 10, 80, 80))
    label89val.delegate = self
    label89val.morphingEffect = .Scale
    label89val.text = "0"
    label89val.textColor = UIColor.whiteColor()
    label89val.font = UIFont.boldSystemFontOfSize(23)
    label89val.setNeedsDisplay()
    self.view.addSubview(label89val)

always crash at

   label89val.text = "0"

and get this error

fatal error: unexpectedly found nil while unwrapping an Optional value

lexrus commented 10 years ago

The set method of text property is a little tricky. I'll fix it later. Try move this line to the end.

MichMich commented 10 years ago

I've got the same problem. I absolutely like the concept, but unfortunalty the current code is unusable. Any idea when this is fixed?

lexrus commented 10 years ago

@zzndino @MichMich I guess it's fixed. Please try again. Thanks.

MichMich commented 10 years ago

Yes, it's fixed. Thanks!