I can not change the uitoolbar background image. gives error.
This navigationBar code is working.
UIImage *navBackgroundImage = [UIImage imageNamed:@"bartop.png"];
[[UINavigationBar appearance] setBackgroundImage:navBackgroundImage forBarMetrics:UIBarMetricsDefault];
But this toolbar code is not working and gives error.
UIImage *navBackgroundImage = [UIImage imageNamed:@"bartop.png"];
[[UIToolbar appearance] setBackgroundImage:navBackgroundImage forBarMetrics:UIBarMetricsDefault];
Where is my wrong?
UPDATE:
This code is working:
UIImage *testimage = [[UIImage imageNamed:@"bartop"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIToolbar appearance] setBackgroundImage:testimage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
[[UIToolbar appearance] setBackgroundImage:testimage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsLandscapePhone];