开发者

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

开发者 https://www.devze.com 2023-04-12 09:00 出处:网络
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 lo

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

精彩评论

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

关注公众号