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
  • 相关阅读:
    并发编程概述
    学习笔记-ResNet网络
    学习笔记-反向传播算法
    学习笔记-canny边缘检测
    学习笔记-霍夫变换
    GitHub访问速度慢的一种优化方法
    C#开源定时回调库PETimer的使用
    C#开源网络通信库PESocket的使用
    XML在C#与Unity3D中的实战运用
    Unity本地持久化类Playerprefs使用详解
  • 原文地址:https://www.cnblogs.com/ioschen/p/3419569.html
Copyright © 2011-2022 走看看