zoukankan      html  css  js  c++  java
  • 自定义UIToolbar

    UIToolbar *myToolBar = [[UIToolbar alloc] initWithFrame:
                                CGRectMake(0.0f0.0f320.0f44.0f)];
        NSMutableArray *myToolBarItems = [NSMutableArray array];
        [myToolBarItems addObject:[[UIBarButtonItem alloc]
                                    initWithTitle:@"myTile"
                                    style:UIBarButtonItemStylePlain
                                    target:self
                                    action:@selector(action)]];
        
        //在UIToolBar上面添加image
        [myToolBarItems addObject:[[UIBarButtonItem alloc]
                                    initWithImage:[UIImage imageNamed:@"myImage.png"]
                                    style:UIBarButtonItemStylePlain
                                    target:self
                                   action:@selector(action)]];
         
         //在UIToolBar上面添加SystemItem
         [myToolBarItems addObject:[[UIBarButtonItem alloc]
                                     initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
                                     target:self
                                     action:@selector(action)]];
     
         //加一个进度条UIProgressView//添加自定义东西要,initWithCustomView
         UIProgressView *myProgress = [[UIProgressView alloc] initWithFrame:CGRectMake(65.0f20.0f90.0f10.0f)];  
         UIBarButtonItem *myButtonItem = [[UIBarButtonItem alloc]initWithCustomView:myProgress];  
         [myToolBarItems addObject: myButtonItem];
        
         [myToolBar setItems:myToolBarItems animated:YES];
         [self.view addSubview:myToolBar];//or set toolbar show  no hidden
  • 相关阅读:
    软件设计7个原则
    vue.js 样式绑定 font-size 问题
    实例理解scala 隐式转换(隐式值,隐式方法,隐式类)
    著名端口整理(常用服务的默认端总结)
    .NET Core Web API 实现大文件分片上传
    ngnix反向代理tomcat,ssl证书配置及自定义错误页面
    微信登录闪退
    gradle如何配置阿里云的中央仓库
    HashMap底层实现和原理
    关于Java中String类的hashCode方法
  • 原文地址:https://www.cnblogs.com/ioschen/p/3419569.html
Copyright © 2011-2022 走看看