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.22k stars 564 forks source link

Text font and color for text attribute #126

Closed minuscorp closed 8 years ago

minuscorp commented 8 years ago

The examples of the library only seems to support attributedText, but why I can't set the attributes of the text (like font and color) directly from the Interface Builder, for example?

cbpowell commented 8 years ago

This is already supported, you should be able to set all the UILabel text properties that are normally configurable via IB. You use the standard UILabel options in the inspector pane though, they're not in the MarqueeLabel-specific section at the top.

Now if you mean to say the settings you specify don't work, then that is of course an issue.

minuscorp commented 8 years ago

Is strange, IB UILabel specific attributes (font, color) doesn't take effect when it inherits from MarqueeLabel and I have to set all this properties:

        cell.routeUsername.text = row.userName
        cell.routeUsername.textColor = .whiteColor()
        cell.routeUsername.font = UIFont(name: "Titillium-Regular", size: 17)!
        cell.routeUsername.marqueeType = .MLContinuous
        cell.routeUsername.scrollDuration = 15.0
        cell.routeUsername.animationCurve = UIViewAnimationOptions.CurveEaseOut
        cell.routeUsername.fadeLength = 10.0
        cell.routeUsername.leadingBuffer = 10.0
        cell.routeUsername.trailingBuffer = 10.0

where that routeUsername is a MarqueeLabel IBOutlet from the IB before they actually takes the properties set in it.

cbpowell commented 8 years ago

Ah OK, good to know. That being Swift code, it might be specific to the Swift version though. I'll try it out with both versions later.

cbpowell commented 8 years ago

Hmm, I have no issue setting the font and text color in the demo projects, in Objective-C or Swift. That includes the tvOS demo, which uses a MarqueeLabel in a prototype cell. Do you have all your IBOutlets connected, and/or your cell identifier specified in the appropriate places?

cbpowell commented 8 years ago

@minuscorp did you ever find the cause of your problem on this?

minuscorp commented 8 years ago

No... I solved it just adding more porperties as I wrote and it just started to work, I think this can be closed by now

cbpowell commented 8 years ago

Cool, glad it works now!