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
  • 相关阅读:
    POJ1741 Tree
    BZOJ3674 可持久化并查集加强版
    BZOJ3673 可持久化并查集 by zky
    BZOJ3174 [Tjoi2013]拯救小矮人
    BZOJ2733 永无乡【splay启发式合并】
    AtCoder Grand Contest 007 E:Shik and Travel
    BZOJ2599:[IOI2011]Race
    AtCoder Regular Contest 063 E:Integers on a Tree
    SPOJ1825:Free Tour II
    AtCoder Grand Contest 012 C:Tautonym Puzzle
  • 原文地址:https://www.cnblogs.com/ioschen/p/3419569.html
Copyright © 2011-2022 走看看