zoukankan      html  css  js  c++  java
  • iOS基础-UItoolBar简单使用

    自定义如图工具栏

     1     //创建工具栏
     2     NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:3];
     3     UIBarButtonItem *confirmBtn = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(confirmPickView)];
     4     UIBarButtonItem *flexibleSpaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
     5     
     6     titleItem = [[UIBarButtonItem alloc] initWithTitle:@"用户类型" style:UIBarButtonItemStylePlain target:nil action:nil];
     7     
     8     //titleItem.tintColor = [UIColor blackColor];
     9     //titleItem.appearance.tintColor = [UIColor redColor];
    10     
    11     [titleItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],UITextAttributeTextColor,[UIColor clearColor],UITextAttributeTextShadowColor, nil] forState:UIControlStateNormal];
    12 //
    13 //    [titleItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],UITextAttributeTextColor,[UIColor clearColor],UITextAttributeTextShadowColor, nil] forState:UIControlStateDisabled];
    14     
    15     titleItem.enabled = NO;
    16     titleItem.tag = 1;
    17     
    18     UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleBordered target:self action:@selector(pickerHide)];
    19     [items addObject:cancelBtn];
    20     [items addObject:flexibleSpaceItem];
    21     [items addObject:titleItem];
    22     [items addObject:flexibleSpaceItem];
    23     [items addObject:confirmBtn];
    24     
    25     if (toolBar==nil) {
    26         toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height, 320, 44)];
    27         [toolBar setBackgroundImage:[UIImage imageNamed:@"search_buttom"] forToolbarPosition:0 barMetrics:0];
    28     }
    29     //toolBar.hidden = YES;
    30     
    31     toolBar.barStyle = UIBarStyleBlackTranslucent;
    32     toolBar.items = items;
    33     [self.view addSubview:toolBar];
  • 相关阅读:
    JQUERY获取text,areatext,radio,checkbox,select值(转)
    如何查看oracle sql执行计划
    Silverlight资源整理
    ORACLE分页SQL语句
    百科名片SEO
    转 JQuery FlexiGrid的asp.net完美解决方案:dotNetFlexGrid 源码、文档、范例程序下载。
    清除SQLServer2005的LOG文件
    GridView EmptyDataText Border
    Uploading Files in ASP.NET 2.0
    Invalid postback or callback argument.
  • 原文地址:https://www.cnblogs.com/dingjianjaja/p/5026756.html
Copyright © 2011-2022 走看看