How I can delete this space between tabbar and collectionView? - ios

How I can delete this space between tabbar and collectionView?
I have a tabbar -> viewcontroller -> collection
this purple rect it is part of ViewController, but the problem that collection view has the same frame as vc.
Here log:
print("Frame.height: collectionView ->\(collectionView.frame.height) --- view \(view.frame.height)")
Terminal
Frame.height: collectionView -> 812.0 --- view 625.0

Are you changing the height of the standard tabbar?
If so, you're doing it in the wrong place, and the ViewController might compute its height before your change on the tabbar. Try modifying the height in viewWillLayoutSubviews.

you probably need to adjust the bottom constraint of the collection view to be the top constraint of the tab bar

Related

When I create my 1st CollectionView using storyboard the CollectionViewCell has default insets from top?

When I create my 1st CollectionView using storyboard the CollectionViewCell has default insets from top(in size inspector it shows zero but it bit down from top of CollectionView) and I cant move it to top, but when I create a second CollectionView and further CollectionView its cell has no insets from top?
In your storyboard, uncheck Adjust Scroll View Inset of the view controller containing the collection view.

TableView - Header and section are not correct

I have some issues with header and section here. My view is below:
Custom navigation with transparent.
TableView frame = screen bounds, contentInset top = 64.
TableView with header clear color.
TableView has 1 section view (view has 3 tab).
When I scroll tableview, section keep under navigation (perfect), but cells are scroll from section to top screen. I want cells only scroll in section, not to top and under navigation bar.
Can I help me? Thank you so much.
This is because the table view clipsToBounds by default is false, which means it will be rendered outside the table view bounds.
A solution:
tableView.clipsToBounds = true

View not reaching the bottom of the device screen using Autoresize Subviews

I have a view controller that has a button at the top center, and a view underneath which will have the collectionview inside. I want this collectionview to scroll separately to the top view (so it scrolls underneath that top section).
This works fine but the view with the collectionview doesn't reach the bottom. You can see in the screenshot I gave the superview a red background - the collectionview doesn't reach to the bottom of the view. All the constraints are fine.
It works if I uncheck "Autoresize subviews" in the Interface Builder for the UIView inside the View Controller but this then makes all the cells and any navigation bars I add inside that view 1000px wide. Why is my view being shortened - and how can I get the best of both these scenarios? A View that hits the bottom of the screen and all the cells/navigation bars the width of the view?
Constraints for the view:
Constraints for the collectionview:
I did have a tab bar too, and the gap is the exact height of my tab bar.
Anyway I fixed this by putting:
self.extendedLayoutIncludesOpaqueBars = YES;
self.edgesForExtendedLayout = UIRectEdgeBottom;
in viewDidLoad method.

Collection View overlaps above when scrolling vertically

So I have collectionView but above that a UIView as well. When I scroll my collectionView vertically and go up, it scrolls and overlaps the UIView.
What could be the solution to make the UIView come on top of collectionView?
What did work was turning off clips to bounds in the collection View from storyboard.
Set the property "Clip to Bounds" to true. It can be done programatically or in the auto layout.
Programatically: colelctionView.clipToBounds = true
Auto Layout:
Your constraints should be like,
View - top,leading,trailing and fixed height
collection view - top,leading,trailing,bottom
and after that setup, you got issue then once try to set below in viewDidload,
self.automaticallyAdjustsScrollViewInsets = false
Try keeping View Below the Collection View in the View Hierarchy.
This looks sneaky, what let us know the effect.
Just play with the Section Inset

Stretch UIView in a ContentView of a ScrollView

I have the following problem:
I have a Scrollview with Autolayout top,left,bottom,right is set on 0, in this ScrollView is a ContentView also set everything on 0. The ContentView contains a ImageView a Segmented Control and a UIView which is connected to 2 different UIViewController.
The UIView is set top 0 to the Segmented Control and to bottom 0 to the contentView.
My Problem is that the UIView in the ContentView is not streets to the bottom of the ContentView. How can i solved this Problem?
Picture 1:
Storyboard UIViewController with ScrollView
Picture 2:
View on an iPhone 6 Plus
Here there are the size inspector constraints pictures:
ScrollView
MainView of Controller
ContentView in ScrollView
UIView in ContentView
Seems like the problem is in scroll view bottom content inset. By default scroll view have automaticallyAdjustsScrollViewInsets property enabled, and if you insert scroll view as nearest view to tab bar (as I can see at screenshot), bottom inset will set as nonzero (this used for show content under transparent tab bar while scrolling). But for use this behavior properly, you should connect scroll view bottom to view (root view) bottom, not to bottomLayoutGuide. Second option - disable automaticallyAdjustsScrollViewInsets property and handle contentInset and scrollIndicatorInsets properties of scroll view manually (set them to UIEdgeInsetsZero if you don't want change your constraints).

Resources