Why can't I set the navigation controller background color in the storyboard? - ios

I don't understand why the background color setting in the storyboard doesn't work for my navigation controller? (See picture)
http://ctrlv.in/299323
I have here set it to bright red but as you can see it does nothing in the storyboard or to the app when I build it.
Any thoughts?
I know I can set the color programmatically, and this is what I am currently doing. However, it would be nice to see the changes in the storyboard so I don't have to build the app every time I make a color change to see the difference.

Yes you can. Notice that you're changing UIView properties not Navigation bar. Look at the screen below:
You have to set Bar Tint property.

Related

How to change UIPopoverPresentationController's arrow color without drawing my own

I want to change the color of the arrow that UIPopoverPresentationController uses to point at its source. The only way I can see to do this is to subclass UIPopoverBackgroundView and write drawRect and draw the popover border and arrow myself. That's a pain, because there are little niceties in the default popover like rounded corners on everything. And I want to make it feel as much at home on the platform as I can.
Do I really have to draw my own popover arrow just to change the color of the arrow?
Update: I've tried setting the backgroundColor of the UIPopoverPresentationController, but it appears to change the color of everywhere the arrow might draw. I've seen it work before, but I can't nail down what makes it work when it does. See screenshot of setting the color to red. The blue is the content of the navigation controller in the popover. It's supposed to be pointing at the button.
The UIPopoverPresentationController's backgroundColor property should handle that for you
Update
I've used this approach a number of times and have never seen what you have in your screenshot. Are you sure you are using popoverPresentationController.backgroundColor and not setting a different background color on a view or container? Below is screenshot of non-centered popover arrow. The view controller background is green, the popoverPresentationController.backgroundColor is red. Shown next to the code setting the value.
Update #2
I looked at the project you posted and found the problem (although I'm not entirely sure why it's the problem). You are setting the popover presentation controller's backgroundColor property inside your presented view controller under viewWillAppear:. I suspect that setting the background color like this after the presentation happened is what triggers the bug pre-iOS 10.
If you set the popover presentation controller's backgroundColor inside your presenting view controller's onPopover: method, where you are also setting the sourceView and sourceRect properties (and before you actually call presentViewController:), everything works correctly.

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?

UITabBarController in storyboard hides content of UITabBarItems

I am a beginner using storyboards for iOS. I have been using the tab bar controller to show my content.
When I first implemented the UITabBar I could see all the icons at the bottom of the UITabController in storyboard and I could see the UITabBarItem at the bottom of each UIViewController. Why is there now a blank grey bar? I can't seem to change the content either in storyboard. I tried adding another UITabBarController but got the same problem, it also has a dark grey bar at the bottom. However when I run the app all the icons appear. How do I fix this so I can see the UITabBarItems in storyboard or should I just try updating them programmatically instead?
Showing a tab bar or not is one of the couple of simulated metrics used in Interface Builder. As such they only serve to have an idea of how your controller would look under different conditions but do not really change anything to the actual controller.
Most of the time the default Inferred option will try to deduce from the Storyboard configuration how it should look like. In your case just connect the tab bar controller to your controller through the viewControllers outlet.
In contrast, below you have some View Controller properties that change both how your controller is previewed in Interface Builder and also its actual behavior (for instance try changing Adjusts Scroll View Insets or Extended Edges).

Storyboard-set iOS 7 Status Bar not shown in right style

I have two Scenes in a Storyboard; a dark one and a light one.
Set to Default in the Simulated metrics' Status Bar section, the light scene's bar is dark and works correctly. The dark scene's is set the same way to Light Content style but it doesn't change.
No mention of the bar anywhere in the code itself, what's wrong?
The simulated metrics is only for XCode. You need to set this for the view in the views viewcontroller.
UIViewController:preferredStatusBarStyle
StackoverFlow question covering the same

Change statusbar tint colour

Is there a way to set the status bar tint colour?
I have my navigationbar tint set to brown and when it's on screen it also changes the statusbar to brown, however on views that I hide the navigationbar the statusbar returns to its original colour.
How can I change the statusbar tint colour to persist trough the application?
There is no way in iOS 5. You can just change your bar style.
But if you take a look at new WWDC 2012 Sessions, you may find something interesting)
Session number 216 - Advanced Appearance Customization on iOS
Maybe keep the notification bar there but cover it up? If the notification bar's color influences that of the status bar, then it would lead me to believe that it just has to be in the window (even buried under another view) to change it.
There is no way in iOS 5 or ealier version of ios.
now ios 6 have feature to change status bar tint color or it will set according to navigation bar pattern Image
But u can use Custom Status Bar
What I do in screens that have no navigation bar is to put in a navigation bar at the top but behind the visible interface. The navigation bar is not visible to the user, but it is visible to the system and causes the status bar to adopt its color.
EDIT: Sorry, I see now that someone else had already suggested this. So I'm just confirming that it does work.

Resources