View under my container view is not showing up on iOS device - ios

I currently have a UIContainerView and a UIView in a view controller, the container view is at the top and the view is at the bottom, it is a small rectangle in which I will put a banner ad. I have constrained both of these things in my view controller but when run the view at the bottom does not show. Below is the Storyboard and the iPhone 5s it is running on.
Here is my device, as you can see it only shows my container view (which has a table view in it), and it does not show the purple view below it:
Here is my storyboard:
Here are my constraints on my view controller:

You should remove View.top = top + 617 constraint and that would fix it.

Related

How to pin image to screen in Swift?

How can I pin an image to the screen like the profile picture in Snapchat on the top left corner? What should I should learn?
I am guessing that they have used ContainerViews. ContainerView is a resizeable View which can itself contain a View Controller. So you can put a ContainerView inside a View Controller and pin the UIImageView to the View Controller (using Constraints) on top of the Container View.
Make sure the UIImageView is in front of the ContainerView in the view hierarchy so it is visible.
Watch this to get some idea about ContainerViews.

How can I add a contraint to the root view instead of TopLayoutGuide?

My ViewController is embedded in a UINavigationController, and it has a view that should be aligned with the top of root view. The root view has dark gray background, and occupies full screen. But this is what it looks like now:
As you can see, the root view is displayed below the status bar, which is expected. But the subview (black) is displayed below a white strip. I guess this is the top layout guide, and my subview has a constraint with its top equal to the bottom of the top layout guide. After I remove this constraint, I cannot add a constraint from my subview to the root view by Ctrl-dragging, Xcode always set up the constraint with top layout guide.
My question is:
How can I add a constraint top of subview == top of root view?
Why does the top layout guide occupy the white region?
self.automaticallyAdjustsScrollViewInsets = true
The default value of this property is true, which lets container view controllers know that they should adjust the scroll view insets of this view controller’s view to account for screen areas consumed by a status bar, search bar, navigation bar, toolbar, or tab bar. Set this property to false if your view controller implementation manages its own scroll view inset adjustments.
You can also set this property from Interface Builder

Embedding a Collection View inside a Container View - extra white-space at top

I have an app that uses a Nav Contoller as it's initial VC, which then has a root UIViewContoller that contains a UIView at the top half, and a UIContainerView at the bottom. In the UIContanerView, I'm embedding a working UICollectionView that contains image buttons that segue to detail views.
The problem is that white space now shows up at the top of the UICollectionView. Given this is around 64 pixels high, it appears to be a ghosting of a Nav Bar 44px + Status Bar 20px = 64.
And if I scroll up everything looks fine and works as expected, and it also allows me to show you what I expected the layout to look like upon launch:
A snippet of my storyboard is below if that helps:
yes, that could be because child view controller embedded in container view gets the impression, that it is a direct child of UINavigationController, which in turn make collectionView leave top 64 pt insets.
TO solve this problem,In your child view controller interface builder, unmark adjust scrollView insets
This should solve your problem
UPDATE
As Dan suggested, we can also fix it programatically, by calling
automaticallyAdjustsScrollViewInsets = false
in viewDidLoad() of your UIViewController

Difference between iPhone simulator and iPhone

I'm building a iOS app for iPhone. I'm using a collection view, to display a supplementary view. The collection view is in a view controller with a navigation controller. I've created the supplementary view in as xib, using autolayout and constraints.
I've set the navigation controller to be invisible:
navigationController!.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
navigationController!.navigationBar.shadowImage = UIImage()
navigationController!.navigationBar.translucent = true
When I run the app on my device (iPhone 6) I see this:
When I run the app on the simulator (iPhone 6) I see this:
So it seems that the view gets a different layout on the simulator. On the simulator the "top space to superview" constraint sees the bottom of the invisible navigation bar as the frame of the superview. Whereas on the actual device, it seen the actual view controller frame as the superview.
How come the differens? Which one should be trusted?
Image of top constraint of the supplementary view:

Container view cut off in xcode

I have a view controller embed into a container view in iOS Xcode project. When I put a button at the bottom of this view controller it will not display in the container that is showing the view. My work around is right now is I added a scroll view. However I would like to get it to work without a scroll view (If possible).
Your button is not showing up indicates that the height of your view controller' view is greater than the display area for your view controller' view on the container view. Adjust your height to match the display height.

Resources