zoukankan      html  css  js  c++  java
  • toolbar

    #import "ViewController.h"

    @interface ViewController ()

    @property (strong, nonatomic) IBOutlet UITextField *textfield;

    @end

    @implementation ViewController

    - (void)viewDidLoad {

        UIDatePicker *date=[[UIDatePicker alloc]init];

        //设置只显示中文

        [date setLocale:[NSLocale localeWithLocaleIdentifier:@"zh-CN"]];

        //只显示日期

        date.datePickerMode=UIDatePickerModeDate;

        //当光标移到文本框时召唤时间选择器

        self.textfield.inputView=date;

        //创建工具条,设置工具条的颜色和frame

        UIToolbar *toorbar=[[UIToolbar alloc]init];

        toorbar.barTintColor=[UIColor orangeColor];

        toorbar.frame=CGRectMake(0, 0, 375, 44);

        //给工具条添加按钮

        UIBarButtonItem *item1=[[UIBarButtonItem alloc]initWithTitle:@"上" style:UIBarButtonItemStylePlain target:self action:@selector(click)];

        UIBarButtonItem *item2=[[UIBarButtonItem alloc]initWithTitle:@"下" style:UIBarButtonItemStylePlain target:self action:@selector(click)];

        

        UIBarButtonItem *item3=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];

        UIBarButtonItem *item4=[[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(click)];

        

        toorbar.items=@[item1,item2,item3,item4];

        //设置文本输入框键盘的辅助视图

        self.textfield.inputAccessoryView=toorbar;

        

        [super viewDidLoad];

        // Do any additional setup after loading the view, typically from a nib.

    }

    -(void)click

    {

        NSLog(@"实现跳转");

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

    @end

  • 相关阅读:
    sharepoint 2013 configure my site
    格式化xml
    斗罗大陆
    spring的beans.xml的配置
    jdom学习:读取xml文件
    java中加载xml文件方法
    struts2中IOC控制反转应用
    struts2.xml的配置与技巧
    struts2中的路径问题
    struts.xml详细配置
  • 原文地址:https://www.cnblogs.com/linximu/p/4417486.html
Copyright © 2011-2022 走看看