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

  • 相关阅读:
    changing a pointer rather than erasing memory cells
    验证码识别 edge enhancement 轮廓增强 region finding 区域查找
    Manipulating Data Structures
    passing parameters by value is inefficient when the parameters represent large blocks of data
    Aliasing 走样
    Artificial Intelligence Research Methodologies 人工智能研究方法
    Thread safety
    include pointers as a primitive data type
    flat file
    functional cohesion
  • 原文地址:https://www.cnblogs.com/linximu/p/4417486.html
Copyright © 2011-2022 走看看