UIView overlapping with tab bar elements iOS - ios

I made a view for a switch view. Now I already had tabbed menu buttons in it. The problem is the subview for the switch view seems to be overlapping with the tab bar icons at the bottom. Please help.

i think thats because your tabBar is set to translucent. set it to non-translucent from storyboard or programatically.
self.tabBarController.tabBar.translucent = false

You should have a constraint that sets the vertical space between your subview and your tabbar.
Also, check that your layout respects the iPhone X Safe Area (https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/), from your image it seems that your elements overlap the safe area at the bottom.

Related

UICollectionView under Navigation Bar, but not under Tab Bar

I have a UICollectionView that I want to go under the navigation bar. Basically I want it to ignore the entire top safe area, yet still want it to respect the bottom safe area, as there's a tabbar there. This is how it currently looks:
But I want the first cell to start directly the very top of the screen, under the (translucent) navigation bar and the status bar.
If I set collectionView.contentInsetAdjustmentBehavior = .never, then the top part works great, but then the bottom part of the collection view content is hidden by the tabbar - you can't scroll all the way to the bottom so to speak. So I have to manually add a bottom inset again? How do I get the height of the tabbar, including any bottom safe area on devices that have the home bar? Or is there a better way to tell the collectionview to ignore only the top area for its content inset adjustment?
You just need to set the bottom content inset of the collection view manually, after setting the adjustment behavior to .never.
The correct inset (including the tab bar and any home bar) can be found in safeAreaInsets.
collectionView.contentInsetAdjustmentBehavior = .never
collectionView.contentInset.bottom = collectionView.safeAreaInsets.bottom
You'll need to do this at a point when the safeAreaInsets have been set, such as viewDidLayoutSubviews.
As far as I remember, it used to be possible by simply adjusting the edgesForExtendedLayout property of the containing view controller, but that was phased out when safe areas were introduced in iOS 11 I believe.

Wrong position of text in search bar

When I tap to search bar in navigation bar title,text of textfield changing position to bottom and placeholder have alignment center. How fix it? Need native vertical center position text and placeholder of search bar.
The problem you are having could be caused by numerous errors.
1)
Scroll View insets in layout is not checked.
2) If constraints are added, they could be affecting the searchTextView insets also. Remove some and check if they are a factor.
3) You have forgotten to adjust the search text offset.
Thx all for answer, I solved this issue. In my case, need uncheck in storyboard Extended Edges - Under Top Bars. And I use custom views in storyboard scenes. I enable opaque navigation bars in storyboard scene and my custom view(nib file) and it work! Thx all for answers,again)

Navigation bar is overlapping the UIView [Swift]

In the picture below, the navigation bar is overlapping the cardview. The whole screen is basically a view from a tab bar. On top is a navigationItem(the green one), then the navigationBar(the red one) and then the CardView.The translucent propery is set to false for the navigationBar but the CardView is still overlapped. I have unchecked the extendedLayout property to but that doesn't have any effect either.
Is there something else I can do to place the CardView below the navigationBar with padding?
You have to set the constraint on the top of the card view to the bottom of the top layout guide.

UIView Under Nav and Tab Bars

Using storyboard and Swift, I have a view controller which has two elements on it. A UITextField, and a UIView, which I use merely to give a colored border to the UITextField. The UITextField is a child of the UIView. See:
The problem I am having is that despite having set the top bar and bottom bar simulated metrics attributes to Opaque Navigation Bar and Opaque Tab Bar respectively, See:
When the app builds and runs the top of the UIView is always underneath the nav bar. My over all feeling is that this is somehow a constraints issue but I have not been able to find the solution to it. How do I set the constraints so that the UIView is always immediately underneath the nav bar, and the bottom of the view is always just on top of the tab bar?
Select your UIView in storyboard and assign constraints to the top margins and to bottom margins. There is a 'Pin' button you use to do this that looks something like a Tie-Fighter ship in Star Wars, it is located at the bottom right of your storyboard view.
This will set margins to stretch to top and bottom always.
That is what the layout guides are for. Pin the top to the Top Layout Guide and the bottom to the Bottom Layout Guide. The guides will always move to adjust for any top and bottom bars.

ios 7 UINavigationBar is above content when using Auto Layout

I am using Auto Layout in a storyboard to position a UICollectionView. I have created a vertical spacing between Top Layout Guide and the CollectionView. But the collection view still starts underneath the navigation bar. Even the prototype cell also has extra padding. Please see images below.
Interface Builder:
Simulator View:
The content should start below the navigation bar but as the user scrolls the content should go under the navigation bar. How do I accomplish this?
In your storyboard go to View Controller properties, and make sure that Under Top Bars option is unchecked.
Also in most cases you want to have opaque navigation bar.

Resources