iOS 8 how make navigationBar transparent even rotate - ios

before today, i think it is so easy to make navigationBar transparent.
but i stuck here also 3 hours...
here is my problem,
I want my navigationBar transparent, but navigationItem not.
but when i rotate my screen, it appear like
i tried to set my navigationBar background clear;
[self.navigationController.navigationBar
setBackgroundImage:[UIImage imageNamed:#"navibg"]
forBarMetrics:UIBarMetricsCompact];
tried
self.navigationController.view.backgroundColor =
[UIColor clearColor];
tried
self.navigationController.navigationBar.shadowImage =
[UIImage imageNamed:#"navibg"];
tried
[[UINavigationBar appearance]
setBackgroundImage:[UIImage imageNamed:#"navibg"]
forBarMetrics:UIBarMetricsCompact];
And i use xcode 7.2.

in your apps plist file add a row call it "View controller-based status bar appearance" and set it make sure it set to Yes and let me know its working or not for customization help pls check http://www.appcoda.com/customize-navigation-status-bar-ios-7/

Related

iOS 7.1 UINavigationbar and UIToolbar

After upgrading Xcode in iOS7.1 my navigation bar and UIToolbar buttons are not shown with correct colour.
When a view first appears the UIToolbar buttons all have the correct default blue colour and when I go to next page/view and come back to the previous view the toolbar buttons are shown in a grey colour.
I have tried to add the blue colour in viewDidLoad and viewWillAppear but no luck. Can someone please help me?
Thanks.
You can set up a theme for certain components all at once and they will be used throughout your application. In my app delegate I created a function when the application is initializing called setupTheme, and it does just that - sets up the "theme" of the application by saying things like [[UINavigationBar appearance] setBarTintColor:], which in effect sets the color of the navigation bar for ANY navigation controller throughout the app. Here's an example from an app that sets up some basic components that are reused so that any time you use them they will already have the correct theme applied.
- (void)setupTheme {
// get our theme colors
UIColor *primaryThemeColor = [UIColor blueColor];
UIColor *secondaryThemeColor = [UIColor whiteColor];
// nav bar
[[UINavigationBar appearance] setBarTintColor:primaryThemeColor];
[[UINavigationBar appearance] setTintColor:secondaryThemeColor];
[[UINavigationBar appearance] setTitleTextAttributes:#{NSForegroundColorAttributeName:secondaryThemeColor}];
// tab bar
[[UITabBar appearance] setTintColor:primaryThemeColor];
// switches
[[UISwitch appearance] setOnTintColor:primaryThemeColor];
// search bar
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:#{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateNormal];
}
Check out the iOS 7 transition guide for more details on specifics https://developer.apple.com/library/iOs/documentation/UserExperience/Conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW1

How put navigationBar backgroundImage without opacity in ios 7?

Hi I have navigationBar with image in ios 7 [xcode 5].
When I run my application my navigationBar auto be blur.
I want to chenge it to regular [no blur].
my code:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"nav_bg.png"] forBarMetrics:UIBarMetricsDefault];
I try add this code but the apps crash:
[[UINavigationBar appearance] setTranslucent:NO];
What need I do to make all my navigation bars in app to regular?
thank
If you are using storyboard you can set it here
If you need to set it in code use
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
in your viewDidLoad

Issued changing the navigationbar image?

Currently, I am able to change the tint of the my UINavigationBar by
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:74/255.0f green:74/255.0f blue:74/255.0f alpha:1.0f];
However when I try to implement the following code to change the image of the UINavigationBar all together, I see no results..
UIImage *navImageBackground = [[UIImage imageNamed:#"texturedNav"] //This being my .png image
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UINavigationBar appearance] setBackgroundImage:navImageBackground
forBarMetrics:UIBarMetricsDefault];
What am I doing wrong here?
You're probably calling the appearance delegate after the navigation bar is already on screen so your request is being 'ignored'. Or, at least, not causing a UI update.
Set the appearance before the navigation bar is shown. Or, force a UI refresh by hiding and showing the navigation bar (without animation).

UINavigationController background color changes that hide Back Button in iOS

Now I am trying to change UINavigationController background image with my custom Image.
I can change with following codes.
[navigation.navigationBar insertSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:#"navController.png"]] atIndex:1];
So I got following pic. That pic is right and show the BarButton.
But when I go to the detailViewController , there is no BackButton. However I can tap without seeing it.
After I back to MainViewController , my UINavigationController Background is happening like following pic.
They are hiding my button. I'm thinking atIndex:1 is making this problem because Index 1 is above 0 and All button Index must be 0.
That's why all buttons are disappearing.
So how can I solve that problem? Please help.
Thanks for your help.
// not supported on iOS4
UINavigationBar *navBar = [purchaseNavController navigationBar];
if ([navBar respondsToSelector:#selector(setBackgroundImage:forBarMetrics:)])
{
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"brnlthr_nav.jpg"] forBarMetrics:UIBarMetricsDefault];
}
Try using the appearance proxy provided by apple
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"your_image"] forBarMetrics:UIBarMetricsDefault];
that will set it for the entire application or you can use
[[self.navigationController.navigationBar appearance] setBackgroundImage:[UIImage imageNamed:#"your_image"]];

transparent image in UINavigationBar

i have made a simple design in photoshop
when i tried to put it in Xcode i had some problems with NavigationBar
i used this code to change the UINavigationBar background image (a PNG transparent image):
UINavigationBar *navBar = [[self navigationController]navigationBar];
[navBar setBackgroundImage[UIImageimageNamed:#"navBar2.png"]forBarMetrics:UIBarMetricsDefault]
everything works fine but the problem is that the image appears in the navigationBar without transparency.
please someone help me to fix the transparency issue i search everywhere without any satisfied answer
NB! Im using IOS 5
You might try setting the navigation bar to translucent.
[navBar setTranslucent: YES];
Do you have it in your Storyboard? Try change the style of your navigation bar into black translucent.
What you can do is set the background color of the view of the navigationController the same as the backgrouond color of the main view.
//Set your view's background color
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:#"view_background"]]];
//Set your custom image for the navigationController
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed: #"navigation_bar_image"] forBarMetrics:UIBarMetricsDefault];
//And then set the background color of the navigationController the same as the one of the view
[self.navigationController.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:#"view_background"]]];
[self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[self.navigationBar setShadowImage:[UIImage new]];
[self.navigationBar setTranslucent:YES];
And make sure you set up tint color to default.

Resources