UINavigationBar crash on iOS 7.0

        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        {      
            [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:230.0f/255.0f green:200.0f/255.0f blue:160.0f/255.0f alpha:1.0f]];
            >>EXC_BAD_ACCESS
            [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navBarBackground"] forBarMetrics:UIBarMetricsDefault];
            // Override point for customization after application launch.
            return YES;
        }

in didFinishLaunchingWithOptionsI am making simple code that works fine in iOS 7.1but doesn't work in7.0

Error: CGImageProviderCreate: Invalid image provider size: 128 x 0.

Error: CGImageCreate: invalid image size: 128 x 0. Failed to create image from bitmap csi data

navBarBackground is located at Media.xcassets. Im using Xcode 5.1

Any idea how to fix it?

+4
source share
2 answers

I solved the problem. In this image Media.xcassetsyou must set the slice to at least 1px enter image description here

+10
source

If you want to tint UINavigationBar, you should usesetBarTintColor:

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:230.0f/255.0f green:200.0f/255.0f blue:160.0f/255.0f alpha:1.0f]];

Edit:

UINavigationBar 320x64 PNG.

0

Source: https://habr.com/ru/post/1539735/


All Articles