开发者

How can I only reload my localHTML anytime it is visited with UIWebView?

I'm making an iPhone app using xcode, but whenever the homepage (localHTML) is visited using the backbutton, the list item stays highlighted. My solution to this is to refresh the page whenever the localHTML is visited. Can anyone suggest an easy way of detecting when the url matches localHTML (should I use isFileURL?) Thanks for your help. Also, the li开发者_C百科st was made with javascript or else I would use deselectRowAtIndexPath.

This is what I came up with, but it doesn't work

-(IBAction)backbutton{
[webView goBack];
NSString *currentURL = webView.request.URL.absoluteString;
if (currentURL = "whatever the file path is") {
[webView reload];
}

is this a valid way to accomplish this? is there a way to get my localhtml's file path by using nslog?


Have you tried having a delay after going back, then refreshing? eg. after

[webView goBack];

have a delay now using nstimer

then

[webView reload];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜