- (void)viewDidLoad
{
[super viewDidLoad];
//
// self.inputTextField.inputView = [[UISwitch alloc ] init]; // 1.创建时间选择器
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
// 设置只显示日期
datePicker.datePickerMode = UIDatePickerModeDate;
// 设置日期为中文
datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"]; self.inputTextField.inputView = datePicker; // 2.创建工具条
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.barTintColor = [UIColor purpleColor];
toolbar.frame = CGRectMake(, , , ); // 2.1给工具条添加按钮
UIBarButtonItem *item0 = [[UIBarButtonItem alloc] initWithTitle:@"上一个" style:UIBarButtonItemStylePlain target:self action:@selector(previousBtnClick)]; UIBarButtonItem *item3 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithTitle:@"下一个" style:UIBarButtonItemStylePlain target:self action:@selector(previousBtnClick)];
UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(previousBtnClick)];
toolbar.items = @[item0, item1, item3, item2]; // 设置文本输入框键盘的辅助视图
self.inputTextField.inputAccessoryView= toolbar; /*
// 1.创建最外面的大view
UIView *view = [[UIView alloc] init];
view.backgroundColor = [UIColor redColor];
view.frame = CGRectMake(0, 480 - 162 - 44, 320, 162 + 44); // 2.创建工具条
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.barTintColor = [UIColor purpleColor];
toolbar.frame = CGRectMake(0, 0, 320, 44);
[view addSubview:toolbar]; // 2.1给工具条添加按钮
UIBarButtonItem *item0 = [[UIBarButtonItem alloc] initWithTitle:@"上一个" style:UIBarButtonItemStylePlain target:self action:@selector(previousBtnClick)]; UIBarButtonItem *item3 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithTitle:@"下一个" style:UIBarButtonItemStylePlain target:self action:@selector(previousBtnClick)];
UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(previousBtnClick)];
toolbar.items = @[item0, item1, item3, item2]; // 3.创建时间选择器
// 1.创建时间选择器
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
// 设置只显示日期
datePicker.datePickerMode = UIDatePickerModeDate;
// 设置日期为中文
datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
datePicker.frame = CGRectMake(0, 44, 320, 162);
[view addSubview:datePicker]; // 4.设置文本输入框的自定义键盘为大view
self.inputTextField.inputView = view;
*/

IOS DatePicker 和 UIBarButtonItem 常用属性的更多相关文章

  1. iOS UIView控件的常用属性和方法的总结

    一 UIVIew 常见属性1.frame 位置和尺寸(以父控件的左上角为原点(0,0))2.center 中点 (以父控件的左上角为原点(0,0))3.bounds 位置和尺寸(以自己的左上角为原点 ...

  2. iOS导航控制器常用函数与navigationBar常用属性

    导航控制器常用函数触发时机 当视图控制器的View将要出现时触发 - (void)viewWillAppear:(BOOL)animated 当视图控制器的View已经出现时触发 - (void)vi ...

  3. ios基础篇(四)——UILabel的常用属性及方法

    UILabel的常用属性及方法:1.text //设置和读取文本内容,默认为nil label.text = @”文本信息”; //设置内容 NSLog(@”%@”, label.text); //读 ...

  4. 【iOS】UILabel 常用属性设置

    UILabel 的一些常用属性,示例代码如下: // 字体大小 label.font = [UIFont systemFontOfSize:14.0]; label.font = [UIFont fo ...

  5. iOS中UI阶段常用的一些方法

    UI 即 UserInterface(用户界面 1.iOS系统版本,每年都有更新.对我们开发者而言,主要的是观察API的变化. 2.iPhone新手机发布,会产生不同尺寸的屏幕,现在市面上有4种尺寸, ...

  6. iOS开发UI篇—transframe属性(形变)

    iOS开发UI篇—transframe属性(形变) 1. transform属性 在OC中,通过transform属性可以修改对象的平移.缩放比例和旋转角度 常用的创建transform结构体方法分两 ...

  7. Swift2.0 中的String(一):常用属性

    字符串算是平常用的比较多.花样也比较多的一个类型,昨天有空把相关的一些常用操作都写了一遍,总结出来.其实iOS里面的字符串更复杂,还有NSString系列等等,那些API太多将来需要用的时候再慢慢学. ...

  8. UITableView常用属性和方法 - 永不退缩的小白菜

    UITableView常用属性和方法 - 永不退缩的小白菜 时间 2014-05-27 01:21:00  博客园精华区原文  http://www.cnblogs.com/zhaofucheng11 ...

  9. iOS开发-UI (一)常用控件

    从这里开始是UI篇 知识点: 1.常用IOS基本控件 2.UITouch ======================= 常用基本控件 1.UISegmentedControl:分段控制器 1)创建方 ...

随机推荐

  1. 通过增删改查对比Array,Map,Set,Object的使用成本和实现方式

    1.Array 和 Map 对比 { // array and map 增 查 改 删 let map = new Map(); let arr = []; // 增 map.set('a', 1); ...

  2. [Unity3D] 5.0 图集合并扩展工具,用于解决UGUI与AssetBundle打包造成资源包过大的问题

    [Unity3D] 5.0 图集合并扩展工具,用于解决UGUI与AssetBundle打包造成资源包过大的问题 2017年07月05日 15:57:44 阅读数:1494 http://www.cpp ...

  3. mui 从子页面返回至父页面,同时刷新父页面

    今天在写页面的时候,有一个需求,就是新闻列表项的时候,会显示出浏览次数,点击进入页面的时候,也会有浏览次数,且浏览次数比点击之前的已经+1了.那么用户返回到新闻列表页的时候,浏览次数应该更新了. mu ...

  4. Python的自增运算与Python变量的浅析

    一.关于Python的自增运算 学了C/C++后再学习Python,不自觉地就打出了自增运算符++,但是发现Python解释器不认识,查了下资料,发现Python中没有这个运算符.这里暂时不探讨自增运 ...

  5. kubectl 命令

    Kubectl 命令表 kubectl run kubectl expose kubectl annotate kubectl autoscale kubectl convert kubectl cr ...

  6. 关于map 及 map 骚操作

    关于map这个东西   很冷门..................   但是,这个博客带你稍微了解一下map:   map用法:一般当作一个下表无穷大的数组   关于它的骚操作:map的鬼畜用法,可以 ...

  7. 华东交通大学2017年ACM“双基”程序设计竞赛 1008

    Problem Description 长度为 n 的序列,把它划分成两段非空的子序列,定义权值为:两段子序列的最大值的差的绝对值.求可能的最大的权值.数据范围:2 <= n <= 10^ ...

  8. E. Beautiful Subarrays 字典树

    http://codeforces.com/contest/665/problem/E 给定一个序列,问其中有多少个区间,所有数字异或起来 >= k 看到异或,就应该想到异或的性质,A^B^B ...

  9. Murano Weekly Meeting 2015.07.21

    会议时间: 2015.07.21 主持人: Kirill Zaitsev, core from Mirantis 会议摘要:  1.murano client和murano dashboard升级到y ...

  10. Sqoop Import数据库时中文乱码解决方案

    首先查看数据库参数编码: mysql> show variables like 'character%'; +--------------------------+--------------- ...