我正在尝试使用 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
我做错什么了吗?如果您需要更多详细信息,请询问我。