ClassyKit / Classy

Expressive, flexible, and powerful stylesheets for UIView and friends.
http://classykit.github.io/Classy/
MIT License
740 stars 76 forks source link

FEATURE REQUEST: Applying more than one class to an UI element #76

Closed TheCoordinator closed 10 years ago

TheCoordinator commented 10 years ago

Following up on the previous issues, this is again another suggestion:

In CSS, you are able to apply multiple classes to an element. An example would be

<h1 id="one" class="two three">Lorem Ipsum</h1>

It seems to me that in Classy, we are only able to apply one class via cas_styleClass (Correct me if I'm wrong).

Is it possible to add this as a feature?

keithnorm commented 10 years ago

You can add multiple style classes to any view in either of these ways:

view.cas_styleClass = @"one two three";

[view cas_addStyleClass:@"one"];
[view cas_addStyleClass:@"two"];
[view cas_addStyleClass:@"three"];

And all of the following style rules would apply:

UIView.one {}
UIView.two {}
UIView.three {}

However, selecting items based on multiple classes is NOT supported at this time, for example this won't apply to the view in the example above whereas it would if you are thinking in CSS terms:

UIView.one.two.three {}

Hope that helps!

TheCoordinator commented 10 years ago

Thanks

latteier commented 10 years ago

I'll note that this doesn't work in the current cocoapod (0.2.4), but does work if using master from git.