UINavigationController详解(三)UIToolBar
来源:互联网 发布:清朝皇帝 知乎 编辑:程序博客网 时间:2024/04/29 01:12
1. 方法一:自己创建
UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0,568-49,320,49)];
toolBar.barStyle=UIBarStyleBlack; // 不限死,很多类型
[self.view addSubview:toolBar];
2. 方法二:显示 navigationController 自带的ToolBar
//显示工具栏(没动画效果)
self.navigationController.toolbarHidden =NO;
//显示工具栏(动画效果推出)
[self.navigationController setToolbarHidden:NO animated:YES];
--------------------------------------------------------------------------------------------------------------------------------
self.navigationController.toolbar------->toolbar是 UINavigationController 的一个属性
@给ToolBar上加内容
UIBarButtonItem *addItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:nil];
UIBarButtonItem *saveItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:nil];
UIBarButtonItem *editItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:nil];
NSArray *items=[NSArray arrayWithObjects:addItem,saveItem,editItem,nil];
[self setToolbarItems:items]; //向UIToolBar添加UIBarButtonItem
//为了使按钮与按钮之间有间距 (这2个也属于BarButtonSystemItem)
UIBarButtonSystemItemFlexibleSpace 表示系统给一个合适的宽度
UIBarButtonSystemItemFixedSpace 用户可以自己定义个宽度
// 设置toolBar的背景图片,ios5之后的方法
self.navigationController.toolbarsetBackgroundImage:<#(UIImage *)#> forToolbarPosition:<# (UIBarPosition)#> barMetrics:<#(UIBarMetrics)#>
- UINavigationController详解(三)UIToolBar
- UINavigationController详解(三)UIToolBar
- UIToolbar UINavigationController UINavigationBar UIBarButtonItem
- UIToolbar UINavigationController UINavigationBar UIBarButtonItem
- UIToolbar UINavigationController UINavigationBar UIBarButtonItem
- UINavigationController--导航控制器(UINavigationBar、UIToolBar)
- 修改UINavigationController、UITabBarController、UITabBar、UIToolBar颜色
- UINavigationController详解与使用(三)ToolBar
- UINavigationController详解与使用(三)ToolBar
- UIToolbar使用详解
- UINavigationController详解
- UINavigationController详解
- UINavigationController详解
- UINavigationController 详解
- iOS学习之UINavigationController详解与使用(三)ToolBar
- IOS学习之UINavigationController详解与使用(三)ToolBar
- IOS学习之UINavigationController详解与使用(三)ToolBar
- iOS学习之UINavigationController详解与使用(三)ToolBar .
- Longest Substring Without Repeating Characters
- MySQL性能优化的最佳20+条经验
- JS判断字符串长度(英文占1个字符,中文汉字占2个字符)
- 降魔篇之springmvc权限控制
- 过河卒
- UINavigationController详解(三)UIToolBar
- 代码整洁之所以重要的七个理由
- codeforces 402B - Trees in a Row
- 也说 Jquery+ASP.NET 实现开心网上传头像剪裁功能
- C++第二周作业
- web开发复习
- windows消息大全
- 堆和栈的区别是啥?
- 光模块,光纤如何区分单模多模