• 自定义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
  • 相关阅读:
    s3c6410时钟初始化
    一句话题解&&总结
    2019-9-2-本文说如何显示SVG
    2019-9-2-本文说如何显示SVG
    2018-8-3-WPF-读取硬件序列号
    2018-8-3-WPF-读取硬件序列号
    2018-8-10-win10-uwp-调试软件启动
    2018-8-10-win10-uwp-调试软件启动
    2018-8-10-使用-RetroShare-分享资源
    2018-8-10-使用-RetroShare-分享资源
  • 原文地址:https://www.cnblogs.com/ioschen/p/3419569.html
Copyright © 2020-2023  润新知