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)创建方 ...
随机推荐
- Python 生成个性二维码
1.1 实验内容 本课程通过调用MyQR接口来实现生成个人所需二维码,并可以设置二维码的大小.是否在现有图片的基础上生成.是否生成动态二维码. 本课程主要面向Python3初学者. 1.2 知识点 P ...
- Python爬虫开发
1. 语法入门 Python教程 2. 爬虫学习系列教程 1)宁哥的小站 https://github.com/lining0806/PythonSpiderNotes 2)Python爬虫开发 3) ...
- 2017-10-20 NOIP模拟赛
Lucky Transformation #include<iostream> #include<cstring> #include<cstdio> using n ...
- maven包依赖问题排除
今天新引入一个包后,运行报如下错误: Exception in thread "main" java.lang.NoClassDefFoundError: scala/Produc ...
- http系列--从输入 URL 到页面加载完成的过程
一.前言 这道题的覆盖面可以非常广,很适合作为一道承载知识体系的题目.每一个前端人员,如果要往更高阶发展,必然会将自己的知识体系梳理一遍,没有牢固的知识体系,无法往更高处走! 二.主干流程 在将浏览器 ...
- iOS sqlite
iOS sqlite数据库操作.步骤是: 先加入sqlite开发库libsqlite3.dylib, 新建或打开数据库, 创建数据表, 插入数据, 查询数据并打印 1.新建项目sqliteDemo,添 ...
- Github网站css加载不出来的处理方法(转,亲测有效)
转载链接:https://blog.csdn.net/qq_36589706/article/details/80573008因为工作需求,自己会经常使用到github,但是突然有一天打开github ...
- Restful 3 -- 序列化组件(GET/PUT/DELETE接口设计)、视图优化组件
一.序列化组件 基于上篇随笔的表结构,通过序列化组件的ModelSerializer设计如下三个接口: GET 127.0.0.1:8000/books/{id} # 获取一条数据,返回值:{} PU ...
- 查询时根据权限更改sql
import java.lang.reflect.Method; import org.apache.log4j.Logger; import org.springframework.aop.Meth ...
- E. XOR and Favorite Number 莫队 2038: [2009国家集训队]小Z的袜子(hose)
一直都说学莫队,直到现在才学,训练的时候就跪了 T_T,其实挺简单的感觉.其实训练的时候也看懂了,一知半解,就想着先敲.(其实这样是不好的,应该弄懂再敲,以后要养成这个习惯) 前缀异或也很快想出来 ...