UIWebView inside UITableViewCell, link detected but not clickable - ios

I have UITableView with one UITableViewCell subclass.
In that class I'm creating UIWebView and set the delegate to the class.
I'm also implementing shouldStartLoadWithRequest.
On loading the tableview, I call the cell.webView loadHTMLString with HTML string (not from the web).
After I call loadHtmlString the shouldStartLoadWithRuquest is called with navigationtype 5.
This also mean the delegate works OK.
Now, I can see the UIWebView with text and blue links, but when I click on the link the shouldStartLoadWithRequest is not called and nothing happen.
I read something about not implementing UIWebView in UIScrollView, but I also disable the scrolling of the UIWebView, I'm just using it as UILabel to display HTML text.
Any ideas why clicking on the link does not work and shouldStartLoadWithRequest is not fire?

grrr.
answering my own question.
the UITableViewCell object was set with userInteractionEnabled = NO in other place..
after changing to YES, it works. not my lucky day.

Related

When WKWebView embed in a UITableViewCell, secondHalf of WebView will not display

This is very strange. I embed a WKWebView into the first cell(IndexPath.row = 0)of a UITableView . and if the webView's content is short ,it works fine.But when I put more text and image in the webView .the bottom part of the webView is not display. I have check the UI layer:
And I found the most upper layer(WKCompositingView) 's height is not right. the second layer is WKCompositingView too.
I don't know why,Buy if I put the WebView into a controller's view it worked fine.
Another point is , if I called a UITextFiled to first responder(call the keyboard out), than then webView will display normally。(but became 2 part ,both WKCompositingView).
can anyone tell me why?
Final , I solved this question by adding [webViewCell setNeedsLayout] in the scrolldViewdidscroll method.
I think, first cell not show out of content. You can add webview into view. After that, add this view into first cell. First cell will show out of content webview.

How can you handle touching a link within a UIWebView when you have a UIView overlay directly on top of it?

I've been researching how to use a UIWebView embedded in a UIScrollView for a while now and cant seem to find an easy fix to my problem. I'm using a UIWebView because a UITextView, although allowing hyperlinks, does not allow you to change the link color from the standard blue apple sets.
But using a UIWebView introduces another problem: It blocks the UIScrollView it is embedded in from handling scroll events because a UIWebView handles these events within its own private implementation.
Although this allows me to use its embedded links, the UIWebView absorbs the touch events which doesn't allow me to scroll up/down when dragging within the UIWebView itself. I worked around this problem by placing a transparent UIView overlay exactly over the UIWebView, intercepting the touch events that it receives, and resigning it as first responder so that the UIScrollView that they are both subviews of can handle the scrolling appropriately.
Now, however, I can't seem to think of solution to the new problem this introduces: I can't click on the links within my UIWebView that is right under the UIView Overlay.
What is the best way to forward touch events to a UIWebView that is right underneath my transparent UIView in order to trigger my UIWebView's delegate method 'webView:shouldStartLoadWithRequest:navigationType:' for tapping on links?
FYI from UIWebView API doc:
Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled.
Back to the question,
UIWebView has property called scrollView, try doing:
webView.scrollView.scrollEnable = NO;

textViewDidBeginEditing: within UIWebView not being called

i´ve created a subclass from UIView and put in a UIWebView. This displays a simple external website which contains just two textfields. The user can type in his email address and the verification.
I´ve already included the UIWebViewDelegate for the webViewDidFinishLoad: method. Additionally i´ve created a NSNotification for "UIKeyboardDidShowNotification".
Everything works, but when i select the second textfield, the first textfield automatically will be scrolled half out of the visible area. I´ve also included the UITextViewDelegate with - (void)textFieldDidBeginEditing:(UITextField *)textField but i get no NSLog from that delegate method.
Any help how i can get the frame of the selected textfield (within a UIWebView)?
Thanks for any hints...
I´ve read that there are no UITextField delegates when using UIWebView. So therefore no information about which textfield is currently selected, right?

How can I close UIWebView after submitting form in the view?

I have a UIWebView that displays a webpage including a feedback form. I want to remove this UIWebView after I submit the form in that view.
How can I do that?
You normally achieve this sort of thing by setting a delegate on the web view, to register for interesting callbacks.
Don't forget to nil the delegate before you dispose of the web view or you might experience a crash.
In the delegate for the UIWebView, within
webView:shouldStartLoadWithRequest:navigationType:
search for a the url triggered by the form submission. If it's present, set a flag value.
Then, in your delegate's webViewDidFinishLoad: method, if the flag is set, remove the webView.
Well You Have not made clear of your allocation of your webview or not familiar with your code .I guess you want to return to previous view from the UIWebView , in that case you can simply the push the viewcontroller containing the webview through a UINavigationController and get back to the view on back button or set a flag in webviewDidStartLoad and webViewDidFinishLoad and remove the view when the flag is set in DidFinish Part else please elaborate your problem.

UITextField is not responding

I'm experiencing some problems with UITextField inside a UITableViewCell.
Things are working well until I open the iOS media player, watch a short movie and going back to my view.
Then, I'm trying to click on the UITextField, but nothing happens and it does not responds to my clicks.
In the same screen (it's a UITableView), I have a switch button (in another row), which is working fine after switching views.
My view is implementing the UITextFieldDelegate protocol and textFieldShouldReturn in particular.
My implementation of textFieldShouldReturn is a simple call to : [textField resingFirstResponder]
I'll appriciate any thoughts or ideas why it happens and how to solve it.
Thanks!
koby
I had this same problem, what fixed it for me was to make sure to return the correct height for the table view cell. Check your heightForRowAtIndexPath function - even though you can see all the objects in your cell they may be outside of a clickable/tappable area.

Resources