1

I am using PixateFreestyle as a pod. I can style views with styleId from the default.css file. I am trying to change the style information on the fly in code. I have tried this:

self.view.styleCSS = [NSString stringWithFormat:@"{ background-color : #991199; }"];
[PixateFreestyle updateStylesForAllViews];

This has no effect. I have also tried:

self.view.styleCSS = [NSString stringWithFormat:@"{ background-color : #991199; }"];
[self.view updateStyles];

This also has no effect.

Is this possible?

ulfie22
  • 11
  • 1

1 Answers1

2

No curly braces in the string, do this instead:

self.view.styleCSS = @"background-color: #991199;";

There's also a category you can import:

#import <PixateFreestyle/NSDictionary+PXCSSEncoding.h>

Then you can make the code cleaner with something like this:

 self.view.styleCSS = @{ @"background-color": @"#991199",
                         @"color"           : @"red"
                       }.toCSS;
pixatepaul
  • 251
  • 2
  • 5