I am trying to zoom a scroll box which is similar to the one here
http://www.quackit.com/html/codes/html_scroll_box.cfm
in a UIWebview.
Assume that I have set the above page as URL for my UIWebview. can I zoom inside the scrollbox ? I am able to zoom the entire webpage by setting the scalesPagesToFit = YES.
I tried setting the delegate of UIwebview subviews which are UIScrollViews to self and returning self.webview in viewForZoomingInScrollView. But I am not able to achieve it.
Is it possible to zoom a scroll Box or a scroll area in HTML page in UIWebview ?
I achieved zooming by handling the mouse move event in Javascript file and I am scaling the appropriate DIV. Now, the problem is that, I am not able to scroll the scaled content horizontally. My HTML page has position: fixed in CSS and I changed that to relative and tried giving overflow:auto and scroll. , overflow-x as scroll. But still the issue is not resolved
Related
I have a ScrollView within which I am adding TextViews, ImageViews and a UIWebView. I am able to dynamically adjust the height of all these views except the UIWebView.
I have turned off the scrolling of the UIWebView, and want to resize the WebView according to its content. And at the same time resize the scrollview according to the resized WebView.
The scrollview should contain the resized WebView. I think there is much discussion about and around this but I haven't been able to reach a concrete solution. So any help would be appreciated.
here is what you can try
After you have loaded content in the UIWebView you can use it's stringByEvaluatingJavaScriptFromString: method to ask the html document for its height. This is a little tricky but should work.
You can do something like this:
NSInteger height = [[webView stringByEvaluatingJavaScriptFromString:
#"document.body.scrollHeight"] integerValue];
The scrollheight mught not be the best. You have a couple of options. Experiment with the document properties mentioned in http://james.padolsey.com/javascript/get-document-height-cross-browser/
after that u can resize you scrollview to the content,
this is the only method seems working, till now. Good- luck
I ma using UIWebView to some html content. And some time the data is more in width or height but I have fixed size UIWebView. So for user perspective I want to show scroller vertical or horizontal to indicate the user that there are some more content are available in this view. I am using
[webView.scrollView flashScrollIndicators];
but it show scroller when I touch UIWebView. I want to show scroller by default. Can you suggest how to do this.
Use the scroll view of the webviw like this:
[(YOUR WEBVIEW).scrollView setShowsHorizontalScrollIndicator:YES];
[(YOUR WEBVIEW)scrollView setShowsVerticalScrollIndicator:YES];
You can do one thing that ,use this
- (void) webViewDidFinishLoad:(UIWebView *)webView){
[(YOUR WEBVIEW).scrollView flashScrollIndicators];
}
It Will show the scroll-indicator when downloading of the content will finish and user will easily understand that , there are more content on the bottom of the page.
The answer here is simple - you can't as it is against the human interface guidelines. There is a reason that the only way you can manually get them to show is by calling flashScrollIndicators. Apple didn't intend for you to show them so if you're going to implement this, it's going to be the hard way (subclassing or creating your own UIWebView).
Appearance and Behavior
When a scroll view first appears—or when users interact with it—vertical or horizontal scroll indicators flash briefly to show users that there is more content they can reveal. Other than the transient scroll indicators, a scroll view has no predefined appearance.
A scroll view responds to the speed and direction of gestures to reveal content in a way that feels natural to people. When users drag content in a scroll view, the content follows the touch; when users flick content, the scroll view reveals the content quickly and stops scrolling when the user touches the screen or when the end of the content is reached. A scroll view can also operate in paging mode, in which each drag or flick gesture reveals one app-defined page of content.
Source - iOS UI Element Usage Guidelines
How can we identify that a user has zoomed the webView so as to resize the other components present. My webView starts from the middle of the screen and when a user zooms the webView it starts to scroll horizontally and vertically but it happens within the webView.The scrolling happens internally. I want to lock the webView from scrolling internally so that when a user scrolls vertically, the labels,textfields etc. on top of the webView also scroll up and not the webView alone. What I want to achieve is pretty similar to iPhone Native Email Client. For accomplishing this, I would like to put this webView on top of a scrollView and when a user zooms it, I would like to reset the content size of my scrollView so that whatever is added to the scrollView like labels and textfields above the webView also scroll when I scroll the webView.
Any ideas?
You could do:
Disallow user to pinch zoom the webview
Detect double tap on your scrollview and toggle webview's scalesPageToFit property AND set userInteractionDisabled on webview
Now you can scroll only scrollview which has all the controls..
You can find help from this
Disabling default zoom effect
and
scalesPageToFit property
I've a UIWebview displaying a .rtf file. The lines of text are wider than the screen.
1) Is there a way to get the text to wrap around rather than going off the edge of the screen and requiring the user to scroll.
2) Is there a way to disable horizontal scrolling in the UIWebView.
Many Thanks
Code
If you want the content to fit inside the view, set it's scalesPagesToFit property to true:
webView.scalesPagesToFit = YES;
If you do that, the pages shouldn't be horizontally scrollable. If they are, you can fiddle around with the stuff in UIScrollView Reference because UIWebView is a subclass of it.
I am currently working on an application for a client, and they have made an odd request. The request involves putting a custom image as the indicator for the scrollview. I am not even sure if this is possible but if it is can you please let me know how one would go about doing that.
Thanks
UIScrollView streches a small, semi-transparent circle image to generate its scrollbars. You can find this image as the first subview of a UIScrollView:
UIImageView *circle = [scrollView.subviews objectAtIndex:0];
However, as I said this image is stretched, and as far as I can tell, only the alpha values are considered when drawing the scroll bars.
So for example if you're only interested in changing the top/bottom ends of the scroll bar, you can try to change this image. However, I doubt you'll be able to do anything interesting.
A possible solution that comes to mind, and this is only a theory, is to add a custom, transparent UIView on top of a UIScrollView. Then you can hide the default scroll bar (by using showsHorizontalScrollIndicator and showsVerticalScrollIndicator), pass the necessary touch events to the UIScrollView to scroll the content, and draw the scrollbars in your custom view.