UIBarButtonItem (系统 Item 样式)
2015-11-25 09:41
351 查看
图示:
示例:
======图1: (UIBarButtonSystemItemFlexibleSpace)
//会根据item的高度自动居中,如果item中的btn不设置frame则不生效 UIToolbar* tool = [[UIToolbar alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-55, self.view.frame.size.width, 55)]; [self.view addSubview:tool]; //半透明,模糊 tool.barStyle = UIBarStyleBlackTranslucent; UIBarButtonItem* cancel = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(cancelCamera)]; UIBarButtonItem* add = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePhoto)]; UIBarButtonItem* add2 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePhoto)]; UIBarButtonItem* add3 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePhoto)]; [tool setItems:[NSArray arrayWithObjects:cancel,add,cancel,add2,cancel,add3,cancel, nil]];
=========图2 (UIBarButtonSystemItemFixedSpace)
//会根据item的高度自动居中,如果item中的btn不设置frame则不生效 UIToolbar* tool = [[UIToolbar alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-55, self.view.frame.size.width, 55)]; [self.view addSubview:tool]; //半透明,模糊 tool.barStyle = UIBarStyleBlackTranslucent; UIBarButtonItem* cancel = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:@selector(cancelCamera)]; cancel.width = 20; UIBarButtonItem* add = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePhoto)]; UIBarButtonItem* add2 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePhoto)]; UIBarButtonItem* add3 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePhoto)]; [tool setItems:[NSArray arrayWithObjects:cancel,add,cancel,add2,cancel,add3,cancel, nil]];
相关文章推荐
- C#实现让ListBox适应最大Item宽度的方法
- 拖动Html元素集合 Drag and Drop any item
- Delphi实现Listbox中的item根据内容显示不同颜色的方法
- Android开发之ListView实现Item局部刷新
- Android中ListView Item布局优化技巧
- Repeater控件动态变更列(Header,Item和Foot)信息实现思路
- SPICE协议marshaller的处理
- listview相关,新手安卓开发求助帖
- ListView中getView的原理+如何在ListView中放置多个item
- item属性总结
- ListView定制不同的Item
- Android软件开发之ListView 详解 (十一)
- ListView中的Item点击和Button点击焦点冲突
- Android Adapter回调接口
- CardView设置item的margin问题
- QML Item详解
- android中图型的阴影效果
- 【Android开发经验】关于ListView中item与控件抢夺焦点的那些事
- android屏蔽listview 的item点击事件
- android开发之ListView.getCount()与ListView.getChildCount()区别