In Order to achieve this you need to implement methods in the UIBarPositioningDelegate protocol:
Here is the code:
@interface ViewController : UIViewController <UIToolbarDelegate>
@property (nonatomic, weak) IBOutlet UIToolbar * toolbar;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
//we become the delegate
self.toolbar.delegate = self;
}
-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar{
//this tells our bar to extend its background to the top.
return UIBarPositionTopAttached;
}
@end