Giter Club home page Giter Club logo

Comments (5)

tolo avatar tolo commented on May 29, 2024

When using nested declarations (or descendant selector chains etc), one must make sure that the leaf element (i.e. cell in this case) is added to the view hierarchy before applying styles. Currently, InterfaCSS doesn't provide any automatic handling for this (this could be accomplished with some method swizzling magic, but I'm trying to avoid such things a much as possible), which means it has to be done manually. One way of doing that is to apply the styles in the willDisplayCell method of the table view / collection view delegate, another way is to do it in the didMoveToSuperview method of a custom cell subclass.

I admit, the documentation around this could perhaps be a bit better...

from interfacss.

TadeasKriz avatar TadeasKriz commented on May 29, 2024

I'm still not able to make the styling work properly. Sometimes it works, sometimes it does not and it's frustrating. Some tableviews don't get styled until I touch them or scroll them. Please advise. Thanks.

from interfacss.

tolo avatar tolo commented on May 29, 2024

Sorry to hear. I'm just in the process of improving documentation, and I am also planning on releasing version 1.1 soon, which will bring improvements along with a bunch of new features.

In the meantime, try this:

  • Log active declarations for a view using this call -[InterfaCSS logMatchingStyleDeclarationsForUIElement:]
  • Have a look at the SimpleSample demo application - that one uses a UITableView (see PrototypeExampleViewController / prototypeExample.css) with at least a moderately complex style setup
  • Try and simplify your selectors, i.e. instead using selectors like UITableView UITableViewCell .myClass, try using just .myCellClass for instance

from interfacss.

tbrannam avatar tbrannam commented on May 29, 2024

With regards to tableview cells - I noticed that my styles didn't get
applied when a new cell is allocated (not recycled) -- in this case the
cell has no superview yet. In my case I manually called [tableView
addSubview:cell] inside my tableView:cellForRowAtIndexPath: if
cell.superview was nil. This allowed my styling rules to match - which
included class for my UITableView.

On Tue, Aug 18, 2015 at 6:46 AM, Tadeas Kriz [email protected]
wrote:

I'm still not able to make the styling work properly. Sometimes it works,
sometimes it does not and it's frustrating. Some tableviews don't get
styled until I touch them or scroll them. Please advise. Thanks.


Reply to this email directly or view it on GitHub
#40 (comment).

from interfacss.

tolo avatar tolo commented on May 29, 2024

Closing this as there doesn't seem to be an underlying problem and likely just a usage issue, which is now documented on the wiki.

Feel free to reopen the issue in case there are indications that there still are issues with table/collection view cells.

from interfacss.

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.