How to create space between UINavigationBar and top of UITableView - ios

I have a UITableView in my storyboard. I put a navigation bar at the top of the view. However the title seems to close to the top of the view near the time and battery. Is there any way to create spacing like in the view to the left of that one? I tried simply dragging the navigation bar down but it seems pinned to the top of the view. Any help is appreciated. Thanks!

If you are using autolayout (which I very much recommend), you are just missing a Vertical Space Constraint between your container view and your table view.
See the size inspector (as shown below) for a list of constraints on a UI element, or browse your Document Outline for missing constraints.

Related

How to remove extra space in UICollectionView when scrolling to top with Status bar gesture?

I have a CollectionView the behavior is normal when I'm scrolling down and If I want to reach to top items using the scroll top top gesture from the status bar I get an extra space.
Extra space in title
Here is a gif showing the behavior:
I don't want that extra space.
I don't know if It's a property in the UICollectionView or in the same NavigationController.
Thanks!
This worked for me the first method setting the top constraint to the superview an not to the safe area "Please take a look at this... i Hope this helps... uicollectionview remove top padding"
Thanks for your help Mr Ahtazaz
you can try this,
first drag and drop a view controller ,
then embed it into navigation controller,
then drag and drop a collection view to the view controller
select the collection view at the bottom there is "add new constraint" click on that and uncheck constraint to margin then give zero to all the four boxes and make sure the red line is highlighted( making sure all the constraints are sets)
click on add constraint now you can rightclick and drag from tabbar to view controller and set it as viewcontrollers

UIView inside UIScrollerView displays with -64 offset

I'm trying to create a form that will be larger than the screen size and I've decided to use a view inside a scrollerview, then I'm adding the rest of the UI widgets (textfields, buttons, etc.) inside the view.
The view displays and scrolls, but no matter what I try, it displays with a vertical offset of -64 below the navigation controller bar. Once there the view will happily scroll up down.
I want the view to anchored at the top, just below the navigation bar, and then scroll down.
I am using IB.
Lots of time researching and not many answers that have worked for me. UIScrollView seems to be like one of those dirty secrets the whole iOS world seems to avoid....
Thank you for your help.
You can fix this in the storyboard
1- Select the view Controller
2- GO to attributes inspector
3- Uncheck adjust scroll View insets
For your view controller, in the storyboard uncheck the option to extend edges under top bar.

Navigation controller and ScrollView Top Layout Guide Margin

I am trying to align a "view" at the top of the screen but below the navigation bar. The view is inside a scrollview. The problem is that there is a gap at the top, where the top layout guide is not honored. I am writing this in Swift. Any solutions? I am attaching a photo of what's going on.
Basically, I want to remove the white part between the navigation controller and the blue background.
I also adding a snapshot of the constraints.

What is the proper way to add a view to a view controller and make it cover it completely through rotations using Auto Layout?

Say I have a UIViewController and I want to add a red UIView atop it that covers its view completely using Auto Layout.
My first instinct was to pin it to every edge of the view controller's view, but due to the iOS 7 nature of view controller views extending underneath the nav bars, pinning it with a constant of 0 doesn't put it under the nav bars. And if I put -64 to cover it in portrait, that's not the correct constant for landscape as the nav bar is shorter.
How should I be implementing this?
Make sure your view is pinned to the top of the super view, not the top layout guide. It sounds like it's currently pinned to the top layout guide.
If it is pinned to the top layout guide, the best way to fix it is to delete the constraint, select the view, click the "Pin" tool at the bottom right of IB, and then select the top with a setting of zero.
This works fine in Xcode 5.1.1, but was a little buggy in earlier versions. Control+Drag onto the view generally forces you to select the top layout guide instead of the top of the view.

Empty navigation bar appearing in subview

I am trying display a UITableView within a larger UIView in an iPad app, mainly because the data is pretty sparse and I'd like to have the table be a smaller area over a background image, rather than taking up the whole screen. The parent UIViewController is correctly set as the table data source and delegate, and the table looks/functions like it should. The whole view is embedded in a navigation controller; the overall UIView shows a navigation bar, as it should, that I can configure normally.
The problem is the UITableView subview also shows blank space at the top for a navigation bar--empty space above the first cell--and I can't figure out how to get rid of it. I know the space is related to the navigation controller, because when I delete the embed link in the storyboard, the space goes away. The table view doesn't present a UINavigationBar property or any other navigation-related properties that I can try to nullify.
I would post a screen shot but I don't have the rep yet.
Can anyone explain where the space is coming from and how to nix it?
I suspect the answer is related to the Top Layout Guide for the view, but I can't diagnose the specific problem.
Here's a workaround from the storyboard: Insert a UIView in the scene, then drag the UITableView into it as a subview. Check the box for the new UIView's "Clip Subviews" in the attribute window, and then use it as a mask, basically, to cover the undesired top margin of the table view. It works and doesn't require any coding, but there has to be a better way.

Resources