zoukankan      html  css  js  c++  java
  • iOS中的UIToolBar

    #import "RootViewController.h"
    
    @interface RootViewController ()
    
    @end
    
    @implementation RootViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        //显示toolbar
        //self.navigationController.toolbarHidden = NO;
        
        //动画效果
        [self.navigationController setToolbarHidden:NO animated:YES];
        
        //背景颜色
        self.navigationController.toolbar.barTintColor = [UIColor redColor];
        
        //渲染颜色
        self.navigationController.toolbar.tintColor = [UIColor orangeColor];
        
        //设置背景图片
        [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"123.jpg"] forToolbarPosition:UIBarPositionBottom barMetrics:UIBarMetricsDefault];
        
        
        UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(handle:)];
        
        
        
        UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(handle:)];
        
        UIBarButtonItem *item3 = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"234.jpg"] style:UIBarButtonItemStylePlain target:self action:@selector(handle:)];
        
        
        UIBarButtonItem *item4 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(handle:)];
        //UIBarButtonItem *item4 = []
        self.toolbarItems = @[item1,item4,item2,item4,item3,item4];
        
    //    UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(20, 100, 300, 30)];
    //    [self.view addSubview:toolBar];
    //    toolBar.backgroundColor = [UIColor redColor];
    //    toolBar.items = @[item1,item2];
        
    }
    
    - (void)handle:(UIBarButtonItem *)item{
        NSLog(@"gogogogo");
    }
    @end
  • 相关阅读:
    <script>标签的加载解析执行
    百度地图API位置偏移的校准算法
    开源实时消息推送系统 MPush
    开源GIS软件 4
    Bootstrap 只读输入框
    javascript中的后退和刷新
    HTML中的文本框textarea标签
    Spring Boot 特性 —— SpringApplication
    SpringMVC使用POST方法传递数据,却出现Request method 'GET' not supported?
    springboot的登录拦截机制
  • 原文地址:https://www.cnblogs.com/wohaoxue/p/4817877.html
Copyright © 2011-2022 走看看