Pixate / pixate-freestyle-ios

Pixate Freestyle for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Styling a label in a custom button class with Pixate

binyamg opened this issue · comments

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;
  • Given the problem above where styles are not being applied at all, is there a way to use the final rulesets and parse and apply each one? In other words, is there a way to force each style property to be applied to a view?
  • I was able to apply the styles by calling:
PXStyleInfo *styleInfo = [PXStyleInfo styleInfoForStyleable:_buttonLabel];
[styleInfo applyToStyleable:_buttonLabel];
  • However, I still do not know why the styles parsed for the label are not being applied by default.