IOS - DatePicker的使用
UIDatePicker *picker = [[UIDatePicker alloc] init];
picker.datePickerMode = UIDatePickerModeDate;
picker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
// 设置键盘
self.myfield.inputView = picker;
// 设置键盘上面的工具条
self.myfield.inputAccessoryView = [UIButton buttonWithType:UIButtonTypeContactAdd];
// 设置键盘上的ToolBar
UIBarButtonItem *prevButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"上一项" style:UIBarButtonItemStyleBordered target:selfaction:@selector(ShowPrevious)];
UIBarButtonItem *nextButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"下一项" style:UIBarButtonItemStyleBordered target:selfaction:@selector(ShowNext)];
UIBarButtonItem *hiddenButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"隐藏键盘" style:UIBarButtonItemStyleBordered target:selfaction:@selector(HiddenKeyBoard)];
UIBarButtonItem *spaceButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIToolbar *accessoryView = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
accessoryView.barStyle = UIBarStyleBlackTranslucent;
accessoryView.items = [NSArray arrayWithObjects:prevButtonItem,nextButtonItem,spaceButtonItem,hiddenButtonItem,nil];
self.myfield.inputAccessoryView = accessoryView;
最新文章
- Introduction of python
- mac composer 安装
- hdu4273Rescue(三维凸包重心)
- Codeforces Round #297 (Div. 2)
- Golang 开发移动应用的OpenGL(Android为例)的渲染管线
- svn 提交失败 更新失败 提示 已经锁定
- C#基础精华07(委托事件,委托的使用,匿名方法)
- div border-radius
- 使用solr报错,错误信息 include(SolrClient.php): failed to open stream: No such file or directory
- win7使用右键导致死机、假死、explorer无法响应的解决方法
- select空间提交form表单传递参数
- 初学Python(八)——迭代
- Nuget私有服务搭建实战
- spring定时任务详解(@Scheduled注解)
- flask 跨域问题
- 【GIS】无人机影像数据关系换算(转)
- selenium键盘操作
- 杭电 OJ 提交代码需要注意的问题
- Sutherland-Hodgeman多边形裁剪
- js中字符串的常用方法