Giter Club home page Giter Club logo

Comments (5)

grp avatar grp commented on August 29, 2024

Objective-C usually favors composition over subclassing. With the current approach, you can add shimmering to any existing view or layer, without having to make a subclass of it.

Using composition can be especially useful when you don't control the creation of the view hierarchy. For example, you could add a shimmering effect to an MPMoviePlayerController's view, which is created and managed by iOS itself.

You can still use it with any view or layer you create yourself as long as you put the contents inside a single view or layer. Then, internally set that as the contentLayer.

from shimmer.

yuchi avatar yuchi commented on August 29, 2024

Sorry if I’ll look dumb, but I really don’t get it.

Using composition can be especially useful when you don't control the creation of the view hierarchy. For example, you could add a shimmering effect to an MPMoviePlayerController's view, which is created and managed by iOS itself.

You’re still going to create a view (whose .layer will be a FBShimmeringLayer) to contain the MPMoviePlayerController whose view’s layer will be used as a contentLayer. Even using -setLayer: you could set an ‘auto-shimmering’ layer to it (I mean, the container).

You can still use it with any view or layer you create yourself as long as you put the contents inside a single view or layer. Then, internally set that as the contentLayer.

That’s exactly what I tried to do, but my special environment has spit on me. (Just for clarity, I’m porting Shimmer to Titanium SDK, where views lay in a very special way, and adding middle-views without breaking the layout is not that trivial.)

from shimmer.

grp avatar grp commented on August 29, 2024

I see what you mean now, the shimmering layer could shimmer all of its children, rather than just the contentLayer. That's an interesting idea — I would suggest forking the code and modifying it as you need for that, since it's likely you'll need other changes as well to work outside the standard Cocoa Touch environment.

from shimmer.

yuchi avatar yuchi commented on August 29, 2024

Actually I just made that changes, it’s just a fact of removing everything contentLayer related. To port that on Titanium I just had to clone what you did on FBShimmeringView, setting the +layerClass.

Would you mind if I make a PR for you to explore the idea?

from shimmer.

yuchi avatar yuchi commented on August 29, 2024

(Oh, by the way, your code is really self explanatory. Awesome component perfectly executed)

from shimmer.

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.