Date Picker和UITool Bar的使用
#import "YYViewController.h" @interface YYViewController ()
/**
13 * 文本输入框
14 */
@property (strong, nonatomic) IBOutlet UITextField *textfield; @end @implementation YYViewController - (void)viewDidLoad
{
[super viewDidLoad];
//
//添加一个时间选择器
UIDatePicker *date=[[UIDatePicker alloc]init];
/**
28 * 设置只显示中文
29 */
[date setLocale:[NSLocale localeWithLocaleIdentifier:@"zh-CN"]];
/**
32 * 设置只显示日期
33 */
date.datePickerMode=UIDatePickerModeDate;
// [self.view addSubview:date]; //当光标移动到文本框的时候,召唤时间选择器
self.textfield.inputView=date; //
//创建工具条
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中只能添加UIBarButtonItem子控件,其他子控件会被包装秤这种类型的
上面的控件依次排放(空格————)
有样式,可以指定样式(可拉伸的),一般用来做工具栏。
使用toolbar做点菜的头部标题
如何让点菜系统居中?在ios6中是正的,在ios7中是歪的
在自定义键盘上加上一个工具栏。
数组里什么顺序放的,就按照什么顺序显示
toolbar.items = @[item0, item1, item2, item3];
//设置文本输入框键盘的辅助视图
self.textfield.inputAccessoryView=toolbar;
Date Picker和UITool Bar的使用的更多相关文章
- iOS开发UI篇—Date Picker和UITool Bar控件简单介绍
iOS开发UI篇—Date Picker和UITool Bar控件简单介绍 一.Date Picker控件 1.简单介绍: Date Picker显示时间的控件 有默认宽高,不用设置数据源和代理 如何 ...
- javascript date picker
一个简洁的date picker <html><head><meta http-equiv="Content-Type" content=" ...
- asp.net使用My97 Date Picker时设置默认起始时间为n年之前的今天
可以使用My97 Date Picker组件来收集用户输入的日期值. 首先下载该组件:http://www.my97.net/dp/index.asp放到自己的项目中. 然后在项目里面引用js和css ...
- Date Picker Calendar For Oracle Forms 6i
Giving date picker calendar option to user for date type fields in Oracle Forms. I am providing you ...
- Freebie: Date Picker Calendar Demo Form For Oracle Forms 6i
I have already posted and provided the required PLSQL Library and the Calendar FMX file in my previo ...
- 微软BI 之SSRS 系列 - 基于时间段参数的 MDX 查询以及时间日历 Date Picker 的时间类型参数化
今天在天善问答里看到一个问题,如果我没有理解错的话,它应该是指比如在一个报表中选取一个时间段,然后求出这个时间段的某个 Measure 的 SUM 和.并且同时求出这两个时间点对应的上一年的时间点之间 ...
- date picker with jquery
<html> <input id="from_time" name="from_time"type="text" valu ...
- 在 static table view 中增加date picker 并进行动态高度设定
http://blog.apoorvmote.com/how-to-pop-up-datepicker-inside-static-cells/
- 文顶顶iOS开发博客链接整理及部分项目源代码下载
文顶顶iOS开发博客链接整理及部分项目源代码下载 网上的iOS开发的教程很多,但是像cnblogs博主文顶顶的博客这样内容图文并茂,代码齐全,示例经典,原理也有阐述,覆盖面宽广,自成系统的系列教程 ...
随机推荐
- postgresql查询的处理过程
本文简单描述了Postgresql服务器接收到查询后到返回给客户端结果之间一般操作顺序,总的流程图如下: 第一步: 客户端程序可以是任何符合 PostgreSQL 协议规范的程序,如 JDBC 驱动. ...
- font-family styles
以下是几种常用字体的字形样式预览: 步骤阅读
- 关于针对class自定义new操作符失败的函数处理
#include <iostream> #include <new> using namespace std; class CSaveCurHandler //用于管理new_ ...
- ios开发错误之: Undefined symbols for architecture x86_64
错误如下: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_RoutingHTTPServer", refere ...
- rqt工具的使用
安装rqt工具sudo apt-get install ros-indigo-rqtsudo apt-get install ros-indigo-rqt-common-plugins或者rosdep ...
- SSH框架使用中存在的诡异异常
背景 相信大多数人目前都在使用Spring + Struts2/SpringMVC + Hibernate来构建项目的整体架构,但是在使用中经藏会遇到一些诡异的问题,不知道如果解决,今天我遇到了一个非 ...
- leetcode 上的Counting Bits 总结
最近准备刷 leetcode 做到了一个关于位运算的题记下方法 int cunt = 0; while(temp) { temp = temp&(temp - 1); //把二进制最左边那 ...
- html5——自定义属性
自定义属性:添加前缀"data-" dataset属性:添加自定义属性后,通过元素的dataset属性来访问自定义属性的值(属性名没有data-前缀) data-name:data ...
- Linux部署Apache ActiveMQ 5.14.1
简单记一下,下载地址 http://activemq.apache.org/download.html 一.安装JDK7以上,官方说明:http://activemq.apache.org/versi ...
- System.map文件【转】
转自:http://blog.csdn.net/david104/article/details/7194185 当运行GNU链接器gld(ld)时若使用了"-M"选项,或者使用n ...