Only Showing Part of a Site in a UIWebView - ios

I am building an iPad app that requires only the middle section of a web page to be visible in a UIWebView. (The entire page without the header and footer)
The portion I need to show is a form where someone enters information into and hits submit. If I position the UIWebView to only show the middle section, when I click on a text area it scrolls up / down to show the right text area on top of the iPad keyboard. This causes the header / footer to be revealed.
It doesn't seem like modifying the source code before it enters the UIWebView will work either, because the form has to work afterwards. (Like I need to be able to hit submit and have it work properly)
I'm wondering if it's possible to add a view to the top and bottom of a UIWebview so that it covers up the header and footer?
Any help would be much appreciated. I can't find a solution that will work for this situation anywhere.

Figured it out -- I was able to add a view onto the UIWebView's scroll view
// Create new view
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,768,200)];
// Add to scrollView so that the added view scrolls with the UIWebView
[webView.scrollView addSubview:view];

Related

Add refreshControl to a scrollView with pageControl

As it can be seen in the gif from the link, I was able to add the refresh control to the scrollView but it is only shown for the first page. It still works for the other pages but it is not showing the refresh indicator which might be confusing for the user.
I have tried already a couple of ideas but nothing seems to work.
I am looking for a solution, which either only makes it possible to use the refresh control on the first page and disables vertical scrolling for the other pages or a solution which shows the refresh indicator at every page.
I would also like to disable the diagonal dragging. I added this in case there is a solution which solves both problems.
https://giphy.com/gifs/KfqJnVlwKE9fwFc07R/html5
Help will be very appreciated.
The indicator looks like it is probably added as a child of the scrollview, meaning it is scrolled along with the other contained views, and hence scrolled off-screen.
For an element you want to always be displayed over the scroll view add the indicator as a sibling of the scroll view (i.e. a subview of the scroll view's parent).

How to make auto expandable home page banner like

I have used the separate banner image and scroll view for category sections and tableview for records.
Need to make all things scrollable to topside and when the scroll position reached the top position category section would fixed at top position and the table view records would continue scrolling and once the scroll down all the object would displayed to their original position back to back well which is normally happen in android apps and whatsapp profile page.
Please share your answer if you have done like this.
Here is the link for DTParallaxTableView
QMBParallaxScrollViewController
This Library same you want MXSegmentedPager
May this helps lot.

How is Twitter profile screen in iOS version built?

I'm wondering how did Twitter implement it's profile screen. At first I thought it is a table view with a header (profile info) and section header (segmented control to choose tweets/media/favorites). It would make sense for me as the profile info goes away while user scrolls down, but segmented control stays, and that's exactly behavior of plain UITableView header view and section header. There is also an image view at the top, under navigation bar, but that's not what's important for me. Here's a visualization of what I think it is:
I tried to recreate it in Interface Builder and that's what I got. The slider drew my attention: it's different than in Twitter app, it starts at the top of table view header, not at the top of cells.
So… how did they achieve it? Did they put a UITableView in a UIScrollView and handled touch/scroll events themselves? I don't think so, since it's discouraged, but I can't think of another explanation.
I'm not sure about the slider, but here they did pretty good job with mimic twitter profile view. So take a closer look, maybe you'll find this helpful.
You can adjust the height of the scroll indicator to sit below your header using
tableView.scrollIndicatorInsets = UIEdgeInsetsMake(yOffset, 0, 0, 0)
yOffset would be the current on screen height of your header. If you adjust this as the user scrolls down using the scrollViewDidScroll method from UIScrollViewDelegate, it will achieve the smoothly changing effect that twitter uses.
This page goes into more detail on creating the twitter profile effect, building on the method described in the link supplied by njuri above including changing the scrollbar to be correctly positioned.

Separate scrollbar of different UI component within a view iOS

I am creating an iPad app that has single view. the left part of the view is a tableView and the right part is a webView. When user clicks on a cell in the table, the webView to the right load the web page that the cell's stored URL points to. Now, everything works fine, except for the whole screen has only one scroll bar.
What I want is something like the Facebook App which you can choose to scroll the left tableView without scrolling the webView and the scrolling of the webView does not affect the tableView. I don't know if it is the problem of running on simulator, there seems to be only one scrollbar for the whole App, and if I scroll my finger on the touchpad of Mac, the whole iPad simulator screen gets scrolled, instead of the individual UI area (tableView or webView) where my mouse lies. Could anyone shed some light? Thanks!
It sounds like you have a problem with your view hierarchy. You need to make sure that the web view is not a subview of the table view or vice versa.
Edit:
Based on the screenshot you provided, it seems that your web view is taking up the whole screen. You need to resize the web view so it does not overlap the table view.

How can I add a scroll view to my iOS application?

I am creating an application for the iPhone which involves having buttons which animate a image view, I created another view in which the buttons are held, however I would like to be able to horizontally or vertically, scroll this view of buttons. I have looked into adding scroll views and I have even followed a tutorial, But I just can't figure out how to add it to my app. Any Ideas anyone? In the tutorial I followed the guy adds the scroll view to the MainWindow.xib, now my app is created and designed in the viewcontroller.xib. So after following the tutorial when I hit build and go it loads that nib and all you see is a white background and a scroll view. (also in that tutorial he scrolled an image where as I would like to scroll a long view of buttons) I realize the newbie-ness of my question could be crazy, but I'm new to programming all together. Here's another additional question, if someone helped me get this scroll view working where would you design the contents of that scrolled view if it's length is longer than the iphone screen? Because It is my understanding that the space to design with in interface builder is the size of the iphone screen and designing interfaces longer than the iphone screen isn't do-able. (of course I know it is do-able I just don't know how to do it).
You can set the content view (scrolling area) dimensions programmatically:
[scrollView setContentSize:CGSizeMake(contentViewWidth, contentViewHeight)];
And then add you view components to the scroll view using the coordinate system of the content view. So say your scroll view was 100x100 pixels and you wanted the scroll view to be twice as wide:
[scrollView setContentSize:CGSizeMake(200.0f, 100.0f)];
You could then add a button to appear on each half of the scroll view:
// First half of content view
button1.frame.origin.x = 10.0f;
button1.frame.origin.y = 50.0f;
[scrollView addSubView:button1];
// First half of content view
button2.frame.origin.x = 110.0f; // NOTE that 110 is outside of
button2.frame.origin.y = 50.0f; // the scroll view frame
[scrollView addSubView:button2];
You could probably design each page of the scroll view as a separate sub view in the NIB and then shift the sub views origin to the correct page location either in Interface Builder or programmatically - but I have never tried this. If this works you'd then be able to layout your buttons using IB.
I would be interested to know if this works.
most views have a .hidden property.
set it to YES to hide -> myscrollview.hidden = YES;
set to NO to show -> myscrollview.hidden = NO;
you can put this hide/show inside an animation and fade out the scrollview.
look-up "simple quartz animation" - it only a few lines of code.

Resources