Search code examples
uitoolbarios5

Custom background image on UIToolbar in IOS5 SDK


Downloaded IOS5 SDK yesterday, and this code which I use to set my UIToolbar's background to a custom image stopped working. If I set the target to IOS4.3 and below it still works.

[self.bizToolbar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbar-iphone.png"]] autorelease] atIndex:0];

Anybody encountered this yet on IOS 5?


Solution

  • You can use: [[UIToolBar appearance] setBackgroundImage:toolBarIMG forBarMetrics:UIBarMetricsDefault]; (new in iOS 5)