UICollectionView scroll changes color of navigation and tab how - ios

I am building an iOS application and have done all the layouts using storyboards and auto layout.
I have a ViewController as follows
For the CollectionView I have specified it to have 4 cells.
The issue I'm having that when I scroll vertically, the background colour of the Navigation bar and Tab bar changes.
How can I make sure that the background colour is not changed when I scroll.
This is what happening when I scroll - You can see the background colour of the navigation and tab bar change.

your navigation bar and tab bar translucent bydefault so add this this code
self.navigationController.navigationBar.translucent = NO;
self.navigationController.tabBarController.tabBar.translucent = NO;

As suggested you can set the toolbar and navigation bar's translucent property to false, but you can also do this in the storyboard:

Related

How to add navigation bar button without using navigation controller from storyboard?

I'm having issues adding navigation bar button to a UINavigationBar directly without using UINavigationController.
The way it appears when using with UINavigationController on iPhoneX, is different from what it looks when i directly add an UINavigationBar.
Even if i set the height of navigationBar manually, the background color and bar button still stick to the top.
Using UINavigationBar
After adjusting height or even using SafeAreaInset to set bar height
using UINavigationController -> desired result

Can't get translucent navigation bar on tableviewcontroller. Works fine with view controller and tableview

I've got a gradient background that I want to show through both the navigation bar and the tab bar. I have them set to "translucent black". If I create a ViewController and put a TableView on it, this works perfectly. However, I can't get it to work properly with a TableViewController. The tab bar works fine, but the navigation bar ends up black. If I turn off "Adjust Scroll View Insets", then the navigation bar looks the way I want it, but the top half of the first table view row gets cut off (see examples). The gradient is on the background view. The background colour of the tableview is clear.
Is there any way to get the same effect on a TableViewController? Do I need to somehow make the heading or first row of the tableview be the background that goes under the nav bar?
ViewController with TableView added:
TableViewController with "Adjust Scroll View Insets" ON:
TableViewController with "Adjust Scroll View Insets" OFF:
After doing a test I think you'd need:
Adjusts Scroll View Insets ON
Extend Edges - Under Top Bars ON
No. 1 allow the UITableView to cover the entire screen (including under the navigation bar) and No. 2 adds a space at the top of the UITableView content so that the content is not hidden under the navigation bar.
I ran into a similar issue trying to set a full screen background on a static table view controller with a clear navigation bar. I solved it by using a backgroundView on my tableView instead of setting backgroundColor. For example:
myTableView.backgroundView = UIImageView(image: UIImage(named: "backgroundImg.png"))
I set my navigation bar to clear, but you could style that however you like:
navigationController?.navigationBar.backgroundColor = UIColor.clear
I also had to set Extend Edges - Under Top Bars ON

How to hide navigation bar and tab bar while scrolling table view in IOS

I have problem with hide tab bar as navigation bar. My requirement is hide both navigation bar and tab bar at same time when I m scrolling table view..my navigation bar is working properly as requirement but tab bar is no not responding to the same....is there any one can help me to sort it out please....????
I m using NJKSCROLLFULLSCREEN for reference..http://GitHub.com/ninjakin/NJKSrollfullScreen
Here is some screenshots of my project..this is what the problem with my tab bar when it hides..!
this is main screen and I want it will look like!
Use https://github.com/tristanhimmelman/HidingNavigationBar
HidingNavigationBar supports hiding/showing of the following view
elements:
UINavigationBar UINavigationBar and an extension UIView
UINavigationBar and a UIToolbar UINavigationBar and a UITabBar

Move navigation bar in navigation view controller in ios7

I want add 20 points margin to my navigation bar. I need it because I want another background color under status bar as youtube did:
I found
iOS Developer library says: Status bar background appearance provided by the window background, if using UIBarPositionTop.
I found solution for toolbar, but I can't move my navigation bar inside navigation view controller. I just set UIBarPositionTop for my navigation bar, but it changes nothing.
-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar {
NSLog(#"position method called");
return UIBarPositionTop;
}
I still see the gray background of status bar instead of white.
Is it possible to do it with a navigation bar or should I use a view with a toolbar?
(XCode 6, development target 7.0+, sdk 8.0, autolayout)
UPDATE: ANOTHER WAY TO RESOLVE PROBLEM
I read this question
and understood, that there is no need to add margin. I added view with background color I need over my navigation bar controller and it resolved my problem.
When you are adding your UIView to the UIWindow, you should change the UIViews size to not underlap the title bar. How to do this is well documented in this post:
Offset on UIWindow addSubview
I hope i understood correctly, look in size inspector, ios 6/7 deltas.
Check this link for an explanation:
Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?

Frame shifted up / empty space between view frame and tab bar with tab bar translucent set to "NO"

Here's my scenario:
I have a UITabBar that is using all the default settings and my app's tab bar translucency boolean is set to YES.
I wanted to change the colors of my tab bar, so I set the (iOS 7) tab bar's barTintColor to [UIColor whiteColor].
However, when I saw the app, this tab bar wasn't as white as it should be. After some time looking through the code, the culprit was the translucency of the tab bar. After setting it to "NO", my tab bar was definitely white. However, when I pushed to my next view controller, there was a black space between my view frame in any view controller and the tab bar. setting the tab bar's translucency to YES would get rid of this problem.
I'm not sure what code I can post since I don't do anything special in viewWillAppear or viewDidLoad in my viewcontrollers (other than setting some custom properties for my feature-set)
Any suggestions? Thanks.
edit: I also tried setting a white image in place of the tab bar's background and it did the same thing even though the translucency was set to "YES" this time.

Resources