iOS开发UI篇—Date Picker和UITool Bar控件简单介绍

//
// YYViewController.m
// datepicker
//
// Created by apple on 14-6-3.
// Copyright (c) 2014年 itcase. All rights reserved.
// #import "YYViewController.h" @interface YYViewController ()
/**
* 文本输入框
*/
@property (strong, nonatomic) IBOutlet UITextField *textfield; @end @implementation YYViewController - (void)viewDidLoad
{
[super viewDidLoad];
//1
//添加一个时间选择器
UIDatePicker *date=[[UIDatePicker alloc]init];
/**
* 设置只显示中文
*/
[date setLocale:[NSLocale localeWithLocaleIdentifier:@"zh-CN"]];
/**
* 设置只显示日期
*/
date.datePickerMode=UIDatePickerModeDate;
// [self.view addSubview:date]; //当光标移动到文本框的时候,召唤时间选择器
self.textfield.inputView=date; //2
//创建工具条
UIToolbar *toolbar=[[UIToolbar alloc]init];
//设置工具条的颜色
toolbar.barTintColor=[UIColor brownColor];
//设置工具条的frame
toolbar.frame=CGRectMake(, , , ); //给工具条添加按钮
UIBarButtonItem *item0=[[UIBarButtonItem alloc]initWithTitle:@"上一个" style:UIBarButtonItemStylePlain target:self action:@selector(click) ]; UIBarButtonItem *item1=[[UIBarButtonItem alloc]initWithTitle:@"下一个" style:UIBarButtonItemStylePlain target:self action:@selector(click)]; UIBarButtonItem *item2=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *item3=[[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(click)]; toolbar.items = @[item0, item1, item2, item3];
//设置文本输入框键盘的辅助视图
self.textfield.inputAccessoryView=toolbar;
}
-(void)click
{
NSLog(@"toolbar");
}
@end
实现效果:

toolbar.items = @[item0, item1, item2, item3];
//设置文本输入框键盘的辅助视图
self.textfield.inputAccessoryView=toolbar;
iOS开发UI篇—Date Picker和UITool Bar控件简单介绍的更多相关文章
- iOS开发UI篇—使用picker View控件完成一个简单的选餐应用
iOS开发UI篇—使用picker View控件完成一个简单的选餐应用 一.实现效果 说明:点击随机按钮,能够自动选取,下方数据自动刷新. 二.实现思路 1.picker view的有默认高度为162 ...
- ios开发UI篇—使用纯代码自定义UItableviewcell实现一个简单的微博界面布局
本文转自 :http://www.cnblogs.com/wendingding/p/3761730.html ios开发UI篇—使用纯代码自定义UItableviewcell实现一个简单的微博界面布 ...
- iOS开发UI篇—CAlayer(自定义layer)
iOS开发UI篇—CAlayer(自定义layer) 一.第一种方式 1.简单说明 以前想要在view中画东西,需要自定义view,创建一个类与之关联,让这个类继承自UIView,然后重写它的Draw ...
- iOS开发UI篇—UITabBarController简单介绍
iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavigationController类似,UITabBarControlle ...
- iOS开发UI篇—懒加载
iOS开发UI篇—懒加载 1.懒加载基本 懒加载——也称为延迟加载,即在需要的时候才加载(效率低,占用内存小).所谓懒加载,写的是其get方法. 注意:如果是懒加载的话则一定要注意先判断是否已经有了, ...
- iOS开发UI篇—CAlayer层的属性
iOS开发UI篇—CAlayer层的属性 一.position和anchorPoint 1.简单介绍 CALayer有2个非常重要的属性:position和anchorPoint @property ...
- iOS开发UI篇—CAlayer(创建图层)
iOS开发UI篇—CAlayer(创建图层) 一.添加一个图层 添加图层的步骤: 1.创建layer 2.设置layer的属性(设置了颜色,bounds才能显示出来) 3.将layer添加到界面上(控 ...
- iOS开发UI篇—CALayer简介
iOS开发UI篇—CALayer简介 一.简单介绍 在iOS中,你能看得见摸得着的东西基本上都是UIView,比如一个按钮.一个文本标签.一个文本输入框.一个图标等等,这些都是UIView. 其实 ...
- iOS开发UI篇—核心动画(UIView封装动画)
iOS开发UI篇—核心动画(UIView封装动画) 一.UIView动画(首尾) 1.简单说明 UIKit直接将动画集成到UIView类中,当内部的一些属性发生改变时,UIView将为这些改变提供动画 ...
随机推荐
- logstash5.x配置
logstash --help --可以通过此命令看到所有命令 -f, --path.config --配置文件路径 -e, --config.string --可直接运行的配置字符串 -w, --p ...
- SQL2005中的事务与锁定(三)- 转载
------------------------------------------------------------------------ -- Author : HappyFlyStone ...
- PeopleTools预警程序制作
预警程序的概念:在主页上显示一个查询的结果.这个查询就是一个Record. 一.在Application Designer建一个项目,包含所有需要的Record. CUX_REC_BLRY Recor ...
- degign new theme for Filezilla(Mac OS X)
the theme directory is located at Filezilla.app/Contents/SharedSupport/resources/ the dirs (excludin ...
- Git 忽略文件
在Git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改 .gitignore 文件的方法.这个文件每一行保存了一个匹配的规则例如: # 此为注释 – 将被 Git 忽略 *.a ...
- SQL SERVER建库&用户赋权限
create database ServiceDB on primary ( name='ServiceDB_data', -- 主数据文件的逻辑名称 filename='D:\WebRoot\DB\ ...
- collectionView布局原理及瀑布流布局方式
一直以来都想研究瀑布流的具体实现方法(起因是因为一则男女程序员应聘的笑话,做程序的朋友应该都知道).最近学习到了瀑布流的实现方法,瀑布流的实现方式有多种,这里应用collectionView来重写其U ...
- python pymongo-ensure_index
create_index 与 ensure_index 一.概述 ensure_index() 在mongoDB中创建索引 看了[1]感觉自己有些断章取义 ----------41316-- 参考链接 ...
- jQuery Easing 使用方法及其图解
jQuery Easing 使用方法及其图解,非常详尽:http://blog.sina.com.cn/s/blog_70a3539f0102v8az.html
- poj2778DNA Sequence(AC自动机+矩阵乘法)
链接 看此题前先看一下matrix67大神写的关于十个矩阵的题目中的一个,如下: 经典题目8 给定一个有向图,问从A点恰好走k步(允许重复经过边)到达B点的方案数mod p的值 把给定的图转为邻 ...