Reputation: 1557
What am I doing wrong here ? I just don't see the toolbar at the bottom of screen Here's my code.
CGRect rect = self.view.frame;
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(rect.origin.x,
rect.size.height-44,
rect.size.width,
44)];
self.bottomToolbar = toolBar;
[toolBar release];
[_bottomToolbar setBackgroundImage:nil
forToolbarPosition:UIToolbarPositionBottom
barMetrics:UIBarMetricsDefault];
[self.view addSubview:_bottomToolbar];
Upvotes: 0
Views: 315
Reputation: 318774
You need to set the toolbar's autosizingMask
to the "flexible top margin" value.
Also, your code deals with the toolBar
variable, the bottomToolbar
property, and the _bottomToolbar
ivar. Either use the property or the ivar. It's confusing to use both like you are.
Upvotes: 1
Reputation: 28727
there is missing one line, its sizeToFit or makeKeyAndVisible() Just look in the example in the ViewControllerProgrammingGuide
Upvotes: 1