IOS DatePicker 和 UIBarButtonItem 常用属性
- (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 常用属性的更多相关文章
- iOS UIView控件的常用属性和方法的总结
一 UIVIew 常见属性1.frame 位置和尺寸(以父控件的左上角为原点(0,0))2.center 中点 (以父控件的左上角为原点(0,0))3.bounds 位置和尺寸(以自己的左上角为原点 ...
- iOS导航控制器常用函数与navigationBar常用属性
导航控制器常用函数触发时机 当视图控制器的View将要出现时触发 - (void)viewWillAppear:(BOOL)animated 当视图控制器的View已经出现时触发 - (void)vi ...
- ios基础篇(四)——UILabel的常用属性及方法
UILabel的常用属性及方法:1.text //设置和读取文本内容,默认为nil label.text = @”文本信息”; //设置内容 NSLog(@”%@”, label.text); //读 ...
- 【iOS】UILabel 常用属性设置
UILabel 的一些常用属性,示例代码如下: // 字体大小 label.font = [UIFont systemFontOfSize:14.0]; label.font = [UIFont fo ...
- iOS中UI阶段常用的一些方法
UI 即 UserInterface(用户界面 1.iOS系统版本,每年都有更新.对我们开发者而言,主要的是观察API的变化. 2.iPhone新手机发布,会产生不同尺寸的屏幕,现在市面上有4种尺寸, ...
- iOS开发UI篇—transframe属性(形变)
iOS开发UI篇—transframe属性(形变) 1. transform属性 在OC中,通过transform属性可以修改对象的平移.缩放比例和旋转角度 常用的创建transform结构体方法分两 ...
- Swift2.0 中的String(一):常用属性
字符串算是平常用的比较多.花样也比较多的一个类型,昨天有空把相关的一些常用操作都写了一遍,总结出来.其实iOS里面的字符串更复杂,还有NSString系列等等,那些API太多将来需要用的时候再慢慢学. ...
- UITableView常用属性和方法 - 永不退缩的小白菜
UITableView常用属性和方法 - 永不退缩的小白菜 时间 2014-05-27 01:21:00 博客园精华区原文 http://www.cnblogs.com/zhaofucheng11 ...
- iOS开发-UI (一)常用控件
从这里开始是UI篇 知识点: 1.常用IOS基本控件 2.UITouch ======================= 常用基本控件 1.UISegmentedControl:分段控制器 1)创建方 ...
随机推荐
- Java中Class Type 类类型是怎么回事?
Java中三种方式可以用来表示Class Type(类的实例对象), 第一种,通过隐藏的静态成员变量class来表示:第二种,通过调用该类的对象的getClass方法:第三种,通过Class.forN ...
- [hdu 1671] Phone List - Trie
Given a list of phone numbers, determine if it is consistent in the sense that no number is the pref ...
- python之02数据类型学习
参考链接:http://www.cnblogs.com/yuanchenqi/articles/5782764.html python的数据类型有:Number.Boolean.String .Lis ...
- 从零开始安装 Ambari (1) -- 安装前的准备工作
Ambari 没有简单的 .tar.gz 结尾的包(反正我找到).apache 官网提供的安装方法,是要下载源码,自己编译成安装包安装.说明文档还不够细.编译的时候是用 maven,照理来说不应该会失 ...
- loj#6053. 简单的函数(Min_25筛)
传送门 题解 \(Min\_25\)筛有毒啊--肝了一个下午才看懂是个什么东西-- \(zsy\)巨巨强无敌-- //minamoto #include<bits/stdc++.h> #d ...
- JMeter - 如何测试REST API / 微服务
概述: 有许多方法和工具可用于测试REST API.当我需要测试REST API时,在查看了各种工具和选项之后,由于以下原因,我选择了JMeter. JMeter是免费和开源的. JMeter可以从C ...
- CBV 与 FBV
FBV:function based view 视图函数,是指之前用的 views.py 中基于函数的开发,url 都是通过函数来实现的,每个 url 对应的函数之间都是独立的. 直接在views.p ...
- Flask&&人工智能AI --3
一.flask中的CBV 对比django中的CBV,我们来看一下flask中的CBV怎么实现? from flask import Flask, render_template, url_for, ...
- 020 Valid Parentheses 有效的括号
给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效.括号必须以正确的顺序关闭,"()" 和 "()[]{}" 是有效的 ...
- Unity Unity脚本类为什么要尽量避免继承MonoBehaviour类?