cbess/AutoScrollLabel

Change text or attributedText without restarting scroll animation

ArquintL opened this issue · 1 comments

Hi,

I have quite a few updates for the AutoScrollLabel (sometimes up to every 3 seconds).
The text has more or less always the same length and if not, I add some spaces, that as often as possible the new text has the same length as the old text.

I've tried modifying the method "setAttributedText: refreshLabels:" and similar "setText: refreshLabels:" as following:

  • (void)setAttributedText:(NSAttributedString *)theText refreshLabels:(BOOL)refresh
    {
    // ignore identical text changes
    if ([theText.string isEqualToString:self.attributedText.string])
    return;

    EACH_LABEL(attributedText, theText)

    //Custom Modification:
    if (theText.length == currentLabelLength)
    return;

    if (refresh)
    [self refreshLabels];
    }

currentLabelLength contains the length of the current displayed text.
If I step over it, I can see, that I get the return as intended, but the scroll animation starts at the beginning.
The problem is now, that because of my often updates, the user is not able to read the entire label, before the scroll animation restarts.

Does someone know a solution or another approach?

Thank you for any help

Linard

Sorry, I was so stupid!
I didn't see, that "setFont:" calls "[self refreshLabels];" too.
I've set the font every time I updated my label, because I was to lazy to move it to viewWillAppear: of my viewController.