zoukankan      html  css  js  c++  java
  • UIToolBar

        //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];
  • 相关阅读:
    Android获取网络图片应用示例
    VC操作MPP文件
    带"叉叉"的GridView
    持续集成之路 —— Mock对象引起的测试失败
    一次httpserver优化的经验和教训(silverlight游戏
    独立开发人员的自由之路 ——1
    Python标准库:内置函数chr(i)
    Matlab The Bisection Method
    ELF解析(part one)
    文件打开的过程——调用fd=open()时操作系统所做的工作
  • 原文地址:https://www.cnblogs.com/hyuganatsu/p/UIToolBar.html
Copyright © 2011-2022 走看看