Git Product home page Git Product logo

Comments (1)

cbpowell avatar cbpowell commented on May 23, 2024

Actually you can do the first half! It's not as straightforward as a single property, but you can immediately set the holdScrolling = true after creating the MarqueeLabel, and then call triggerScrollStart() at the appropriate time to trigger a scroll loop. That method overrides the holdScrolling property only once, so the label will stop scrolling once it completes a loop (at which point you could trigger it again, if you wanted).

I can see a few potential issues with implementing a numberOfRepetitions property, because MarqueeLabel (as a UIView) doesn't necessarily know what it's container UIViewController is doing. I think to do it right, you might want to subclass MarqueeLabel and integrate it more closely with your UIViewController, since you know exactly what you what to do (i.e. when does the count of loops get reset?).

You can subclass MarqueeLabel and override the labelReturnedToHome(finished: Bool) property to keep track of when a loop finishes, and maybe increment/decrement a numberOfRepetitions property (also added to the subclass). When that count meets the right number, you can set holdScrolling == true to prevent the next loop. Your view controller can then adjust this count value and holdScrolling when appropriate. Hope this helps!

from marqueelabel-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.