UIView at bottom UIScrollView does not appear - ios

I'm trying to get an UIScrollView working with my Storyboard. It works but the UIView at the bottom that I use with a gesture tap for getting back is not showing. How can this be?
So everything works expect that. This are the things that I did:
Set freeform in Storyboard
Disable auto layout for the Storyboard nib
Changed the freeform dimensions to X:320 Y:800
Dragged some labels and stuff in the Scrollview
Created an outlet for the ScrollView
Enabled scroll programmatically
Enabled Contentsize CGMakeSize() programmatically;
So I normally did everything, why isn't my UIView showing up at Y:750. The only thing I do with the UIView is setting the Background/CornerRadius.

It would be if your UIView is no included in the calculation for the content size. Other than that I cannot see anything obvious.

Related

Content in UIScrollView is being cutoff early

I have several UIViews within aUIScrollView and I want them to scroll all the way to the bottom of the UIScrollView before cutting off (See Image #2).
Background on the scroll view:
I created the UIScrollView itself is a subclass of a customUIView. I put the view in a UIScrollView so the auto layout in storyboard creates the correct frame for the device.
In the view controller attached to the storyboard UIViewController I created anIBOutlet to theUIView, and in the viewDidAppear function I called a function attached to the view that populated the UIScrollView.
In the storyboard I gave the view a blue background so I could tell its frame. Here is the what the storyboard looks like:
Then this is what it looks like on my phone:
Notice how much space exists between where the view cuts off and where the bottom of the screen is. It does this on all devices.
I have tried adjusting the bottom content inset. It is currently at 0.0 but I tried to make it -20 and that did not help.
How can I fix this?

Add UIScrollView to UIViewController

I am trying to add a UIScrollView to an existing UIViewController (with navigation and tab bar) using storyboard and autolayout but I don't get this to work. Up to now I have added all components to the controller by dragging them on it. Now I try to group them in a UIView, so that I can make this UIView a subview of UIScrollView. When I drag my existing components as a subview of my newly created UIView the position of it is wrong. So I must manually correct all positions. Afterwards the compoents are 64px below their old position.
I just cant get it to work. Is there a tutorial or something how to add an UIScrollView to an existing storyboard?
This is the easiest way to learn how to control a UIScrollViewer within a Storyboard.
http://agilewarrior.wordpress.com/2012/05/18/uiscrollview-examples/
You might want to deselect Ajust Scroll View Insets in interface builder.
You can also set in your viewDidLoad :
self.automaticallyAdjustsScrollViewInsets = NO;

Creating UIScrollView in Storyboards

I simply have a ViewController and added UIScrollView into that. Later on I created UIImageView which is larger than UIScrollView and inserted into the UIScrollView.
However when I run the simulator, UIScrollView does not scroll. I can bounce it but it does not simply leave it's current position within the UIImageView.
I also tried using [scrollView setContentSize:CGSizeMake(320, 640)]; within my viewDidLoad and it did not really work.
So how can I make the UIScrollView to actually scroll?
I am using Xcode 5 and iOS 6.1
Set the contentSize in viewDidAppear rather than viewDidLoad. Make sure scrolling enabled is checked in the storyboard under the attributes inspector (select the scroll view and press the shield icon on the right top).

Advice on how to use a UIScrollView

Hello I have some app (from book) which looks like this:
You can see the image is cropped. I want to have a UIScrollView
which allows to scroll up and also see the whole picture.
This is how my app looks in interface builder.
What do you suggest where should I add ScrollView (as which subview etc.) to achieve what I need? (I guess I will need some intermediary UIView?)
This is what I usually do for fixed contents:
In IB create your view with a UIScrollView at your desired size and position connected to a scrollView outlet.
Also in IB create the view for the contents (bigger than the scroll view). Connect this to a UIView outlet called contentView.
In viewDidLoad do this:
// Put the content view into the scroll view
[self.scrollView addSubview:self.contentView];
self.scrollView.contentSize = self.contentView.bounds.size;
If you want dynamic contents then programatically lay them out in viewWillLayoutSubviews and set the contentSize of the scrollView.
Add the UIScrollView as a direct child of Control, and then put everything else inside the scroll view.
Add UIScrollView as first child of your main View and put all of your controls (UITextView, UILabel,...etc ) as sub view of UIScrollView.
And use UIScrollView property contentSize for set your visible area.
For more information read this tutorial.
You should add the UIScrollView directly under Control, then everything else, besides the toolbar should go into it.
What I usually do in these cases is set the scrollView to the size so all content fits, add the content, then resize the scrollview so it only occupies as much of the screen you want.

iOS: Stretching ImageView Above My TableView?

I have added a UIImageView on top of my tableView in storyboard & it works perfectly fine, except that when you scroll down, the imageView doesn't stick to the navigationBar and instead only sticks on to the tableView (revealing the view's background above it).
How would I get it to stick to both the tableView and the navigationBar, and just have the imageView stretch/zoom as the user pulls the tableView down?
This is how it's set up in storyboard:
And this is how I assign an image to it in my ViewDidLoad:
childHeaderView.image = [UIImage imageNamed:headerImage];
Any help would be greatly appreciated. I've tried setting constraints on it using autoLayout but it doesn't seem to let me (they're grayed out, even though I've enabled it for that ViewController).
The problem is that what you did in storyboard is adding the UIImageView as a header to your UITableView.
The proper way to do this is to add the UIImageView at the same level as the UITableView, which mean embed these two views inside a UIView.
Having a UIView as a root view for a view controller is unfortunately impossible for a UITableViewController, and I fear that this is your case. So you may want to replace your UITableViewController subclass by a UIViewController subclass.
EDIT: You'll want to set a fixed height constraint on your UIImageView, and add a vertical space constraint with a 0pt value between your UIImageView and UITableView.
Most of these can be achieved by moving view in IB.

Resources