0

I want to display local html file that has css too in UIWebView. I am able to do that using following code..

NSURL *baseUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];

NSString *path = [[NSBundle mainBundle] pathForResource:@"info" ofType:@"html"];

NSString *htmlString = [NSString stringWithContentsOfFile:path];
[webView loadHTMLString:htmlString baseURL:baseUrl];

I am not able to get hover effects and my understanding is my be there is no hover kind of thing in a touch mobile,

Any ways my main issue is I had deleted my index.html from resources and then re added the updated one but not getting the updated one..

I don't know what happen the web view still loads the old html file. I tried to clean project too.

Second thing can I get css effects in iphone..?

Thanks..

Kapil Choubisa
  • 5,152
  • 9
  • 65
  • 100

2 Answers2

1

As far as I know you can only achieve this result by using javascript-events like ontouchstart (or something).

cutsoy
  • 10,127
  • 4
  • 40
  • 57
  • hello @Tim.. can you plz navigate me to any tutorial you are talking about.. Please. – Kapil Choubisa May 05 '11 at 07:14
  • I actually replied to your first question (hover-css), example (might contain some typos): `ontouchstart='this.className="over";'` and css: `#obj.over {color: red;}`. – cutsoy May 05 '11 at 13:43
0

I believe if you reset your simulator (While running your simulator, go to iOS Simulator > Reset Content and Settings in the menu bar) then re-run your app, the UIWebView will load the new index.html. UIWebViews cache these things, so you can add code to clear that cache and/or ignore the cache. Check here: Clearing UIWebview cache

Community
  • 1
  • 1
groomsy
  • 4,945
  • 6
  • 29
  • 33