iphone开发之toolbar的使用

[来源] 达内    [编辑] 达内   [时间]2012-09-07

UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemCompose target:self action:@selector(settingButtonClicked)];

  IOS 3.0以后,navigation controller自带toolbar

  显示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];

资源下载