0

我正在尝试使用 CSS 的动态更新,但它似乎不起作用。我在整个过程中改变了背景,但没有任何改变。这是一些伪代码:

//When I launch the iOS simulator
button {
  background-color:red;
}
//During the process I change the value
button {
  background-color:yellow;
}

我的 didFinishLaunchingWithOptions 函数看起来像:

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.styleMode = PXStylingNormal;

[self.window makeKeyAndVisible];


[PixateFreestyle currentApplicationStylesheet].monitorChanges = YES;
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"default.css"
                                                     ofType:@"css"];

 [PixateFreestyle styleSheetFromFilePath:filePath withOrigin:PXStylesheetOriginApplication];
 NSLog(@"%@", [PixateFreestyle currentApplicationStylesheet].filePath);
 [PixateFreestyle updateStylesForAllViews];
 return YES;
}

在我的控制台中,我有这一行:

Users/gumcher/Library/Application Support/iPhone Simulator/7.1/Applications/C16AD475-448C4106-A721-CF8E2AEE80C7/ConnexionSystem.app/default.css

我做错什么了吗?如果您需要更多详细信息,请询问我。

4

1 回答 1

0

我回答我的问题,路径不好我改为

/Users/gumcher/Path/to/myapp/default.css
于 2014-08-22T14:53:43.350 回答