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];
  • 相关阅读:
    LPR之我见
    安装tensorflow2.2cpu的简洁方法
    anaconda安装keras
    redis 查看当前连接数
    2020 8 14
    docker安装jenkins
    使用docker安装gitlab
    提问:游戏测试与一般的软件测试的区别在哪里?
    “战斗天使”- 测试媛是如何崛起的?
    关系型数据库的几种常用主键
  • 原文地址:https://www.cnblogs.com/hyuganatsu/p/UIToolBar.html
Copyright © 2011-2022 走看看