Ah! Your problem is URLWithString:. You want fileURLWithPath:. :) -Matt
Sent from my iPhone On Aug 18, 2012, at 12:12 PM, Koen van der Drift <koenvanderdr...@gmail.com> wrote: > > On Aug 18, 2012, at 2:46 PM, Matt Patenaude <m...@mattpatenaude.com> wrote: > >> User stylesheets should work just fine, so you should try to figure out >> what's going wrong with that. Perhaps don't use standardPreferences; use >> [self.webView setPreferencesIdentifier:@"mySpecialPreferences"] to generate >> a new preferences object for your WebView, then [self.webView preferences] >> to get a preferences object to customize. > > Nope, still doen't work, the custom css is not used. Unless I did something > wrong: > > [self.webView setPreferencesIdentifier: @"mySpecialPreferences"]; > > WebPreferences *prefs = [self.webView preferences]; > [prefs setJavaScriptEnabled: YES]; > [prefs setCacheModel: WebCacheModelDocumentBrowser]; > [prefs setPlugInsEnabled: YES]; > > NSString *path = [[NSBundle mainBundle] pathForResource: @"default" > ofType: @"css"]; > NSURL *cssUrl = [NSURL URLWithString: path]; > > [prefs setUserStyleSheetEnabled: YES]; > [prefs setUserStyleSheetLocation: cssUrl]; > > [self.webView setPreferences: prefs]; > > > >> >> If that still doesn't work, why don't you just hide your WebView and show a >> spinner while it's loading, and then after it loads and you've injected your >> stylesheets, show it? > > The delay is a separate issue, but this works great to prevent it. Thanks! > > - Koen. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com