I have a html page with iframes where part of the page is scrollable while other parts are not.
Is there a way to display this in a UIWebView and allow scrolling these iframe sections?
So far I see that only the entire page is scrolling.
No, it's not possible.
The UIWebView is composed by a UIScrollView, the content is rendered inside it.
So, basically what you want is to create an UIScrollView inside an UIScrollView. Dispatching the gestures will be a big challenge. Which one should scroll?
Related
I have added a UIWebView along with some labels inside UIScrollView (using StoryBoards) by adding it as a subview and then setting the ScrollView height to show all the html content of WebView that is loaded in it using loadHtmlString.
The links in the html content are not working. A little searching revealed that Apple does not recommend putting UIWebView inside UIScrollView to avoid unexpected behaviour. But as i also have to add labels and other stuff other than the UIWebView, so i have to embed them inside UIScrollView.
Is there any way I can make the links work in the html content without violating and Apple's recommendation?
There is no reason to put a UIWebView inside a ScrollView. UIWebView will scroll and zoom and pan the content properly as is. It is sort of redundant unless you have some other layout reasons for example combining it with some other views.
The correct way to add your labels is to add them to a UIViewController or NavigationController and have them positioned around the UIWebView and to also add the UIWebView to that as well.
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 was working on webview. I am facing an issue where I want to display html as well as UIbuttons.
I made webview added Ui butons but when I scroll webview the webview scrolls but the uibuttons remain at the same location.
I've not actually tried this, but in theory this should be possible on iOS 5. If you just add the button to the UIWebView it won't work - as you'll find, when you scroll the views you add remain in place. In iOS 5 Apple added the scrollView property to UIWebView, so if you add your views to that instead (the scroll view) you may find it works?
I have a scrollView and inside it some scrollViews , and everyone have a webview to show html file, using this method I will zooming every html file , but Now I found that when I scroll the html file it didn't work. I think I scroll the scrollview inside and it autosize the html file , but How to let the scrollview inside not to call the scroll function and when I scroll the html it can call the scroll function outside, and I have disable the scroll property of inside scrollview, but it didn't work, and How to do with it? Thank you very much!
UIScrollView in UIScrollView is a common use. See apple stocks app...
I am trying to send ScrollView Gesture events like pan and zoom from outside the scrollview itself. It doesn't look like apple lets you send to the UIScrollViews handlePan: and handleZoom: methods
A quote from UIScrollView Class reference :-
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
I would add : "You should not embed UIScrollView objects in UIScrollView "
I need following view structure, with embedded 2 UIWebViews and 1 UIView (loaded from other xib).
But the problem is, because this need to be inside UIScrollView, with same impression like this is single page. (only vertical scrolling need to be enabled).
In those UIWebViews, html content is loaded from NSString.
Size (height) of UIWebViews and child view is variable.
Any advice, how to do that?
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.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html
However why cant you make a webview that has two iframes, with the content of your two html-files? Then attach this webview to the uiview?
Iframe resource:
http://www.w3schools.com/tags/tag_iframe.asp