I am loading an HTML file in my UIWebView and displaying it in my app. Now I want to all the user to edit this html in the UIWebView real time (i.e. when he is viewing it in the UIWebView). To put it in a different way; Does UIWebView allow editing it's HTML content like a UITextField or UITextView does?
No. It doesn't allow HTML editing.
The closest solution I think of is getting the HTML content and put it in a UITextView but that wouldn't be very user-friendly.
How about split the screen into two view. Web view and text view. Edit text in the text view. When user tap a 'done' button apply the changed text to the web view. Or you can use timer to continuously update web view with the current content of text view.
Related
I want to create uiTextField overlay on uiWebview and it is on the same position on the uiwebview input field.
i.e.: when user clicks on the textfield available on webview then new UITextfield is created and displayed over html textfield. when Editing is done uitextfield disappears then value is placed inside the textfield inside webview.
My application is in Phonegap architecture. please provide any suggestion or examples.
Thanks...
take one view, set background to clearColor & put textField inside it, show dynamically when you clicks your webView TextField. because of clearColor it feels like it is on webView
I have a UIWebView with the content editable set to true. Now if tap on the UIWebView a cursor appears on the UIWebView and the keyboard pops up. Now I am able to write some thing in this editable UIWebView.
My problem is that when I try to clear the content of this editable UIWebView, the content gets cleared but the keyboard is also gets dismissed. I want to clear the content of the editable UIWebView without dismissing the keyboard.
I am using following code to clear the editable UIWebView.
[self.webView loadHTMLString:#"" baseURL:nil];
Any help would be appreciated.
You could try and clear the webview through javascript:
[webView stringByEvaluatingJavaScriptFromString:#"document.body.innerHTML = '';"];
Reloading the web view will set it into a default state where it is not currently being edited and the keyboard is hidden. With the above snippet, you are going to directly change the content of the web view without affecting its state.
I got UITableView with e.g. 5 sections . the headerViews of each section are UIWebViews (to display html formatted Text).
While scrolling to a section header which wasn't in window before. the html content is empty until the scroll animation is stopped. after stopping the UIWebView loads its content.
is it possible to view the text while scrolling like a label?
You can use coretext for this purpose. Its simply awesome just as using a UILabel.
You should read this article: http://nickharris.wordpress.com/2010/06/17/fast-uitableviewcell-with-a-uiwebview/
It explains your problem very well and also comes with some code that will help you!
[edit]Also this one, with a github demo here
I have one webview that fits fullscreen and loads an html file. Then another html file is loaded and I would like to apply transition between those files. Possible? Switch between two views that contains another webview is not an option due to any other reasons. Thank you.
You may insert a UIWebView inside a UIScrollView. Then when you have to load the new page, you create another UIWebView and its x will be the width of the current UIWebView, then addSubview the new UIWebView to the scrollview, and update the scrollview contentSize. Then call the method scrollRectToVisible:animated of scrollview to the frame of the new web view, this do the transition.
In addition, if you don't want to back to the previous page, you may destroy the previous UIWebview and reset the contentSize of the scrollview as it was initially.
How "another html file is loaded"? By events in the first webpage?
If you are writing the html pages you could use jQuery mobile transition?
See here
Even if you are not writing the html pages you might be able to inject javascript for this.
I'm displaying a UISearchBar at the top of a UIWebView for entering information that I use to display content in the UIWebView. Is there a way to attach the UISearchBar (or perhaps a UITextField?) to the UIWebView "header" so that when the user scrolls down on the webview the UISearchBar also scrolls out of view and the full window is able to display text?
If this is not possible, how else could I accomplish this while still using the UIWebView for it's inherent text formatting capabilities?
You may try containing the UIWebView and UISearchBar within a UIScrollView. That is, create a controller that has the main view as a UIScrollView and then add in the UISearchBar and UIWebView as subviews. If you want custom behavior when you're scrolling you may have to override the event callbacks for scrolling. I haven't tried this but in theory you could have it so that when you get a scroll down and the UISearchBar is in view, you hide it up to a certain # of pixels until the UISearchBar is hidden. Afterwards you forward the scroll request to the UIWebView so it can deal with things. Basically have a middleman that delegates the scroll events as necessary.