Pixate / pixate-freestyle-ios

Pixate Freestyle for iOS
Apache License 2.0
849 stars 134 forks source link

Styling a label in a custom button class with Pixate #166

Closed binyamg closed 9 years ago

binyamg commented 9 years ago

Does Pixate Freestyle support styling custom UIView or UIButton subclasses?

I have a button subclass, which uses an imageview and a label. I am using Pixate Freestyle and I am able to style the button background but I can't style the label in the button.

I tried the selector 'button label' and the style is not applied; But I checked the matching rulesets for my button label and it shows that the style in my scss file for ('button label') matches:

NSString *rulesets = [PixateFreestyle matchingRuleSetsForStyleable:self.buttonLabel]; NSLog(rulesets); //prints out the style shown below.

This is in my scss file:

button label {
color: blue;
background-color: pink;
border-width: 3pt;
border-color: brown;
font-size: 30pt;
}

Do you have any idea why this would not work? I have tried the following:

[PixateFreestyle updateStyles:self.buttonLabel]  //or

//this does not work either
self.buttonLabel.styleCSS = @{ @"background-color": @"purple",
                                   @"color"           : @"yellow"
                                   }.toCSS;
binyamg commented 9 years ago
binyamg commented 9 years ago
PXStyleInfo *styleInfo = [PXStyleInfo styleInfoForStyleable:_buttonLabel];
[styleInfo applyToStyleable:_buttonLabel];