sumderungHAY
sumderungHAY

Reputation: 1337

UIwebView links delay

I have a UIWebView with some links in it. When I click the link, there's a delay of about 2-3 seconds before the link is loaded. Is this how it's suppose to be or is there a setting I can change? Thanks.

Upvotes: 5

Views: 3043

Answers (3)

reekris
reekris

Reputation: 548

In iOS5 the UIScrollView belonging to a UIWebView has been exposed so that you can change its behavior. So to remove the click delays you can simply do:

[webView.scrollView setDelaysContentTouches:NO]

This way you don't have to use any javascript libraries to remove the delay.

As a bonus, you can make the scrolling in a UIWebView feel a bit more native by changing the decelerationRate:

[webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal]

Upvotes: 11

SPatil
SPatil

Reputation: 1003

Check if you are calling the load method on main thread or not. If you are testing it on Simulator then calling a method on secondary thread takes some time to execute rather than crashing or throwing an exception. Replace such call (if any) by performSelectorOnMainThread method.

Upvotes: 0

sergio
sergio

Reputation: 69027

If you mean that after clicking the link there is a delay before the the link is highlighted, this has to do with how the touches are handled by the UIWebView. I doubt that this can account for the whole 2-3 secs delay, but anyway refer to this post to remove it.

If you mean that after clicking on a link it takes 2-3 seconds until you can see the page rendered, then it is (unfortunately) normal. UIWebView is known for being slow at rendering even a simple page.

Upvotes: 0

Related Questions