cbpowell / MarqueeLabel

A drop-in replacement for UILabel, which automatically adds a scrolling marquee effect when the label's text does not fit inside the specified frame
MIT License
4.21k stars 564 forks source link

Problem with swift4 ? EXC_BAD_ACCESS (code=2, address=0x1097ceea8) #221

Closed surani444 closed 6 years ago

surani444 commented 6 years ago

Hi. I read the instructions and added MarqueeLabel to my project, but MarqueeLabel codes are crashing the app on the first line of these codes:

import MarqueeLabel

@IBOutlet weak var artistName: MarqueeLabel!

@IBAction func onClickPrev(_ sender: UIButton) { self.artistName.text = artistName self.artistName.speed = .duration(20) //----here self.artistName.animationCurve = .easeOut self.artistName.type = .continuous }

screen shot 2018-07-23 at 5 26 18 pm

Thanks for this greate library.

cbpowell commented 6 years ago

Glad you find it useful!

Did you change the label custom class to MarqueeLabel in Storyboards? This crash typically happens when the object you're referencing as a MarqueeLabel is still the default UILabel, which doesn't have the .speed variable. See the info in the read me here: https://github.com/cbpowell/MarqueeLabel/blob/master/README.mdown#storyboards

Let me know if this fixes your issue! If not, could you please post your crash log?

cbpowell commented 6 years ago

Going to assume you got this figured out - please reply back if not!