0

In the home page of my iphone application i am calling a web page, users can do some actions(comment,like etc) from other tabs of my app-After that,when the come back to home page the web page must be refreshed(eg:- comment/like count must be incresed) If user do the refreshing of home page(scroll up from top) the page is getting refreshed,but the client wanted to refresh it automatically So i have loaded the web page in viewDidAppear method, Now problem is-whenever user come back to home page it gets refreshed and showing from the top(if user go to detail from some link at bottom and come back,webpage shows the top)

how to prevent this,or is there any better idea for automatic refreshing ?

1 Answers1

0

Perhaps a better way would be to use javascript to download the updates in the background, then update your content appropriately. UIWebView has a method –stringByEvaluatingJavaScriptFromString: which can be used to run javascript code. You could supply the method call to perform the refresh in your -viewDidLoad method.

Another option could be to download the HTML in the background, and compare it too what is displayed, if different, swap. That way content is only refreshed when needed. Although that still gives you the problem of content moving to the top.

Amit Shah
  • 4,176
  • 2
  • 22
  • 26