Snail—UI学习之工具栏UIToolBar
2015-08-10 14:14
603 查看
#import "WJJViewController.h" @interface WJJViewController () @property (nonatomic, strong) UIToolbar * toolBar; @end @implementation WJJViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 100, 320, 50)]; [self.view addSubview:self.toolBar]; self.toolBar.backgroundColor = [UIColor blackColor]; //为自己的item添加一个方法 UIBarButtonItem * item1 = [[UIBarButtonItem alloc] initWithTitle:@"asds" style:UIBarButtonItemStyleBordered target:self action:@selector(item1Click:)]; //调用系统的BarButtonItem /* UIBarButtonSystemItemDone, UIBarButtonSystemItemCancel, UIBarButtonSystemItemEdit, UIBarButtonSystemItemSave, UIBarButtonSystemItemAdd, UIBarButtonSystemItemFlexibleSpace, UIBarButtonSystemItemFixedSpace, UIBarButtonSystemItemCompose, UIBarButtonSystemItemReply, UIBarButtonSystemItemAction, UIBarButtonSystemItemOrganize, UIBarButtonSystemItemBookmarks, UIBarButtonSystemItemSearch, UIBarButtonSystemItemRefresh, UIBarButtonSystemItemStop, UIBarButtonSystemItemCamera, UIBarButtonSystemItemTrash, UIBarButtonSystemItemPlay, UIBarButtonSystemItemPause, UIBarButtonSystemItemRewind, UIBarButtonSystemItemFastForward, */ UIBarButtonItem * fixSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:nil action:nil]; UIBarButtonItem * item3 = [[UIBarButtonItem alloc] initWithTitle:@"asdsda" style:UIBarButtonItemStyleBordered target:self action:@selector(item3Click:)]; self.toolBar.items = @[item1,fixSpace,item3]; } - (void)item1Click:(id)sender{ NSLog(@"1"); } - (void)item3Click:(id)sender{ NSLog(@"3"); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
相关文章推荐
- 【HDU5357】Easy Sequence 题解(栈的应用)
- 如何调整UIPickerView,UISwitch等无法通过frame调整大小的大小
- iOS UILable根据文本内容自适应高度
- Ueditor .net版安装配置打开项目的源代码傻瓜版教程 亲测~
- UI控件切圆角
- IOS开发UI篇--IOS动画(Core Animation)总结
- DevExpress控件库---MarqueeProgressBarControl控件和ProgressBarControl控件
- substring() intValue() valueOf()
- iOS开发UI篇--iOS动画(Core Animation)总结
- UI资源索引
- leetCode #232 Implement Queue using Stacks
- Android属性之build.prop生成过程分析
- Codeforces Gym 100589A Queries on the Tree 树状数组 + 分块
- HDOJ 1159(POJ 1458)Common Subsequence (最长公共子序列 LCS)
- idea自动生成serialVersionUID
- HDU 1159(Common Subsequence)最长公共子序列
- Leetcode60 Permutation Sequence
- hdoj 1159 Common Subsequence【LCS】【DP】
- iOS 3D UI---CALayer的transform扩展
- 抗锯齿方法两种(其一:paint.setAntiAlias(ture);paint.setBitmapFilter(true))