当前位置: 代码迷 >> Iphone >> iphone上toolbar的使用
  详细解决方案

iphone上toolbar的使用

热度:76   发布时间:2016-04-25 06:25:00.0
iphone下toolbar的使用
IOS 3.0以后,navigation controller自带toolbar, 原文如下:“In iOS 3.0 and later, a navigation interface can display a toolbar and populate it with items provided by the currently visible view controller. The toolbar itself is managed by the navigation controller object.”
显示toolbar以及toolbar基本的设置代码如下:
[self.navigationController setToolbarHidden:NO animated:NO];self.navigationController.toolbar.barStyle = UIBarStyleBlack;	UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemCompose target:self action:@selector(settingButtonClicked)];NSArray *myToolbarItems = [[NSArray alloc] initWithObjects: item, nil];                 [self setToolbarItems: myToolbarItems animated:YES];

toolbar的隐藏:
NewOrderViewController *newOrder = [[NewOrderViewController alloc] initWithNibName:@"NewOrderView" bundle:[NSBundle mainBundle]];newOrder.hidesBottomBarWhenPushed = YES;[self.navigationController pushViewController:newOrder animated:YES];

具体解释的原文为:
“To hide the toolbar for a specific view controller, set the hidesBottomBarWhenPushed property of that view controller to YES. When the navigation controller encounters a view controller with this property set to YES, it generates an appropriate transition animation whenever the view controller is pushed onto (or removed from) the navigation stack.”


  相关解决方案