UIWebView user interaction (click) delay - iphone

whenever I make a tap action on a UIWebView, for example clicking a link, there is a slightly delay between the tap and the actual highlighting / activating of the link.
Is there a way to disable this delay?
I've read that this would be possible in UIScrollView with
setDelaysContentTouches:NO
Is this also possible in UIWebViews?

This is the solution I used:
http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone

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]
As a bonus, you can make the scrolling in a UIWebView feel a bit more native by changing the decelerationRate:
[webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal]

Related

loadHTMLString won't fire while UIScrollView is scrolling

I'm trying to lazy load UIWebViews inside a UIScrollView.
Every time the user scrolls, the WebViews frames are updated and new content SHOULD be loaded. And that's exactly where I'm having trouble. The repositioning works well, but the new content (local NSStrings, which are called using loadHTMLString) does not appear until I stop scrolling the ScrollView.
I've read this thread already: NSURLRequest won't fire while UIScrollView is scrolling.
Getting some inspiration from that, is there any association I could make between loadHTMLString and NSURLConnection? I know next to nothing about NSURLConnection.
If that's not possible, is there any other solution? Either halting the scroll for a while (like MobileRSS – an App Store app – does) or alternate loading methods?
Edit: My UIScrollView has paging enabled. So if I were to halt the scroll for a while, it should happen at every page. But I still don't know how to accomplish that.
Old question, but here is an answer for it.
You'll have to subclass the UIWebView and switch the run loops started at a overridden loadHTMLString:baseURL:
and switching it back after the html has been loaded (or failed to load).
Check out this project on github which gives you an example of where to override in all the right places.

iPhone UIWebView touch cause Toolbar to appear

I am trying to have a UI which is a full screen UIWebView. When the view is touched the tool bar appears.
I can do everything but get the touchend event in the UIWebView. I have tried putting a UIColor.Clear'd UIView ontop and catching TouchEnd there and passing it on, but would like a better solution.
I understand that we are not supposed to subclass the UIWebView from the docs.
Ideas?
I found a better solution. Simple have the HTML in the UIWebView send a message to the client via a document.location = "SomeCommandName"
Then catch this in code and toggle the view as needed.
Much simpler.

Tap navigation bar to scroll to top

I have a really long UIWebView, and I need to add a way for the user to tap the UINavigationBar to scroll to top (something like the Facebook app, where it's little glow when you tap).
How can I do this?
In iOS5, you can now access the UIScrollView directly, allowing you to scroll to top.
[webView.scrollView scrollRectToVisible:animated:]
That should take care of everything that you need.
You could use javascript to scroll the web view to the top. You could execute the javascript from the Objective-C side using
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script

Highlite Select Text in UIWebview

i want to Select text using gesture and highlite that text.i had done display html page in UIwebview but uiwebview does not fire touch begin event, So how can i do.
1) when user select text (i.e user select text "i Know uesr" that part of text color should be change.
if you have any idea below of the query,kindly suggest me..
Thank you
Milan
If you look at the docs for a UIWebView, you know your options are limited.
You're going to have do it with javascript. Your only weapon is - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script and your ability to load every page as a string (which you can manipulate) before passing it to you UIWebView as a page (using - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL).
So... good luck with that. ;)
Brute force method
You can trap the touches as the Window level by subclassing UIWindow. Then you can manually locate the view the touch occurred in and then the location in the view.
As to actually highlighting the text with the OS, I think you might have to put a transparent overlay view on top of the webview and then draw the highlight there.
You're going to have trouble selecting in a webview because a single touch also opens links. You're going to have to create an interface that distinguishes between link touches and selection touches.

How to create a full-screen modal status display on iPhone?

I'm trying to create a modal status indicator display for an iPhone app, and would like one similar to this one used in Tweetie:
Specifically, this one "shades out" the entire screen, including the toolbar. I don't believe through any normal UIView manipulation, I can extend past the bounds of my window, can I? I believe I've seen a status indicator like this somewhere else on iPhone, possibly when I added an Exchange e-mail account.
I've tried subclassing UIAlertView and overriding its drawRect method. If I don't call [super drawRect:] it doesn't ever display the normal UIAlertView text box, however my drawing rectangle is in an odd size and position.
Anyone have any advice to accomplish this?
Check out MBProgressHUD.
Take a look at the source code to the WordPress application. They have code which you can basically drag and drop into your application to do this.
http://iphone.wordpress.org/development/
I haven't done this myself, but you could layer a UIView at the top of the view hierarchy, and use setHidden to dynamically show or hide it. Since it's at the top of the stack, it should be able to intercept all touch events.