UIToolbar UIToolbarPositionBottom
Constants to identify the position of a toolbar for appearance customization (see setBackgroundImage:forToolbarPosition:barMetrics:).
typedef enum {
UIToolbarPositionAny = 0,
UIToolbarPositionBottom = 1,
UIToolbarPositionTop = 2,
} UIToolbarPosition;
Constants
UIToolbarPositionAny
Indicates the toolbar may be in any position.
UIToolbarPositionBottom
Indicates the toolbar is at the top of its containing view.
UIToolbarPositionTop
Indicates the toolbar is at the bottom of its containing view.
UIToolbar UIToolbarPositionBottom example.
By subclassing UIToolBar and overriding drawRect, you eliminate some of UIToolBar's own drawing. Why not use the appearance api to set a background image:
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"UIToolBar_Background.png"]
forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"UIToolBar_Background.png"]
forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
Example of [UIToolbar UIToolbarPositionBottom].
[_bottomToolbar setBackgroundImage:nil
forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[self.view addSubview:_bottomToolbar];
forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[self.view addSubview:_bottomToolbar];
UIToolbar UIToolbarPositionBottom example.
UIImage *barImage=[[UIImage imageNamed:@"BarBg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(27,0,27,0)];
[tool setBackgroundImage:barImage forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[self.view addSubview:tool];
[tool setBackgroundImage:barImage forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[self.view addSubview:tool];