To set UIToolBar background Image I use the below code.
UIToolbar *tool=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 100.0)];
[tool setTintColor:[UIColor darkGrayColor]];
UIBarButtonItem *btn=[[UIBarButtonItem alloc] initWithTitle:@"Load" style:UIBarButtonItemStyleBordered target:nil action:nil];
[tool setItems:[NSArray arrayWithObject:btn]];
UIImage *barImage=[[UIImage imageNamed:@"BarBg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(27,0,27,0)];
[tool setBackgroundImage:barImage forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[self.view addSubview:tool];
This shows the following output
But question arises where is the purple colour background image, which I had set?
If I change the position top the output changes to
[tool setBackgroundImage:barImage forToolbarPosition:UIToolbarPositionTop
barMetrics:UIBarMetricsDefault];
This is what I expect, when setting background image.
So I don't have any clear idea when to use UIToolBarPositionTop or UIToolBarPositionBottom?