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.”
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值