UIToolBar
2015-11-23 16:22
441 查看
//UIToolBar 是导航控制器默认隐藏的工具条 //设置UIToolBar的隐藏状态 self.navigationController.toolbarHidden = NO; //如何找到UIToolBar self.navigationController.toolbar //UIToolBar高度:44 //设置UIToolBar类型:barStyle self.navigationController.toolbar.barStyle = UIBarStyleDefault; //设置UIToolBar的颜色:barTintColor self.navigationController.toolbar.barTintColor = [UIColor redColor]; //设置UIToolBar的图片 [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"toolBar.png"] forToolbarPosition:UIToolbarPositionBottom barMetrics:UIBarMetricsDefault]; //UIBarButtonItem 文字类型 UIBarButtonItem *wordButton = [[UIBarButtonItem alloc] initWithTitle:@"button" style:UIBarButtonItemStylePlain target:self action:@selector(barButtonClick:)]; //UIBarButtonItem 图片类型 UIBarButtonItem *imageButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"itemImage.png"] style:UIBarButtonItemStylePlain target:self action:@selector(imageButtonClick:)]; //UIBarButtonItem 系统类型 UIBarButtonItem *systemButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(systemButtonClick:)]; //创建空格 //会均分掉空白部分,空格的点击事件不会实现,无效 UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(spaceClick:)]; //向UIToolBar上面添加按钮 self.toolbarItems //需要接收数组:数组里面的元素必须是UIBarButtonItem类型 self.toolbarItems = @[space, wordButton, space, imageButton, space, systemButton, space];
相关文章推荐
- iOS学习笔记--03 UITableView相关
- UITextField *textfield常用的取消键盘方法
- dialect does not support sequences
- UITextField
- java+uiautomator 打包运行
- 做一个Active To
- maven web项目build失败
- UIImageView
- iOS-利用UIScrollView实现展示图片的无限滚动及自动滚动 - 郭晓
- UIControl源码分析
- java +UIAutomator 通过中文文本查找控件 报错问题
- UIImageView设置为圆形
- [置顶] MFC使用duilib的几种方式
- 如何使用require.js?
- iOS 根据uuid取得外设
- UITableview中怎么找到每个cell
- NSNotificationCenter(通知)与Key-Value Coding (KVC)与Key-Value Observing (KVO)
- UIImageView中图片尺寸模式
- Kibana User Guide [4.2] » Settings » Managing Fields
- [iOS]UITableView优化技巧