I want to convert my current project from iOS 6 to iOS 7. In iOS 6 my project is working fine, but in iOS 7 navigation bar image is not showing properly.
I used this code snippet for iOS 6,
UIImage *imgNav = [UIImage imageNamed:@"navigation.png"];
self.navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 44);
[self.navigationController.navigationBar setBackgroundImage:imgNav forBarMetrics:
UIBarMetricsDefault];
How can I set the navigation bar image in iOS 7?
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigation.png"] forBarMetrics:UIBarMetricsDefault];
Its working if you follow the rules mentioned in ios7 guide: • If you want a solid color with no gradient, create a 1 x 1 point image. • If you want a vertical gradient, create an image that has a width of 1 point and a height that matches the height of the UI element’s background. • If you want to provide a repeating textured appearance, you need to create an image with dimensions that match the dimensions of the repeating portion of the texture. • If you want to provide a nonrepeating textured appearance, you need to create a static image with dimensions that match the dimensions of the UI element’s background area.
For more Info Please follow the link:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/ResizableImages.html#//apple_ref/doc/uid/TP40006556-CH30-SW1
Just do this..