Can we add UIbuttons, uilabels on to webview and make them scrollable along with the web view in iPhone? - iphone

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?

Related

UIScrollView Not Scrolling In iOS 7 StoryBoard

I am trying to add a UILabel along with a UIWebView together in a view controller and want them to scroll together. So to accomplish that, i have added a UIScrollView behind these two views but the UIScrollView is just not scrolling. I am using Storyboard and iOS 7 SDK.
I have seen many questions but they are not of much help. Some are suggesting that i should disable the AutoLayout that i cannot do due to the requirements of my project. What else can i do to make it work? Thanks!
According to Apple's documentation, you shouldn't use UIWebView inside UIScrollView. What you can do is to add your UILabels and UIWebView inside aother UIView and then add this UIview inside the UIScrollView.
Secondly, you have to set the contentSize of the UIScrollView in order for it to work.
You also have to disable the scrolling of UIWebView that is embeded inside the UIScrollView.
Still if your problem is not solved. It is better to just turn of AutoLayout. I have had the same issue and i wasnt able to solve it without disable the AutoLayout.
The documentation for UIWebView states:
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.
You need to wrap the label and web view in a regular UIView. Add the regular view to the scroll view.

UIWebView Inside UIScrollView Html Links Not Working

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.

iOS drag & drop for UIPageControl

Is there a way to implement for iOS a drag and drop behavior for a custom icon located in the first page of a UIPageControl to the second page (like moving icons from iPhone's home screen to a different page)?
Thanks.
UIPageControl is only a controller to display dots to indicate the number of scrollable pages in UIScrollView.
You need to use UIScrollView and using UIScrollViewDelegate.

displaying a smaller UIWebView as a form sheet

I'm trying to pop up a UIWebView on iPad with a web site that is specifically sized for the iPhone (320x480). I want the web view to be centered, and transition in using a zooming animation. Other apps have this functionality, but I can't seem to find out how to do it. I've tried various combinations of presentation & transition style, but no matter what I do, the web view takes up the entire screen and slides vertically to cover the screen. I've made the web view 320x480 in IB, and am using UIModalPresentationStyleFormSheet, which should make it at least slide up into the center of the screen using a small window, but that is not occurring.
anyone know what's wrong?
Are you setting the property of the parent UIViewController or the modal UIViewController? Because you should be setting the properties of the modal UIViewController before presenting the controller instead of the parent.
This might be no help at all because you're doing the right thing, but it was the first error I made when starting to use MVCs.
maybe any of the autosize property is set. just do one thing bind your webview with the code and through code try to set the frame. Hope it will work as it worked many times to me when i faced similar types of problem.
hAPPY cODING...

UIWebView with UISearchBar for searching

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.