------------------------------------------------------------------------------------------
//// VIEwController.swift// UIDatePickerSample//// Created by jinnchang on 15/4/2.// copyright (c) 2015年 Jinn Chang. All rights reserved.//import UIKitclass VIEwController: UIVIEwController { var datePicker: UIDatePicker! overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() // Do any additional setup after loading the vIEw,typically from a nib. datePicker = UIDatePicker(frame: CGRectMake(0,self.vIEw.frame.size.height - 400,self.vIEw.frame.size.wIDth,400)) datePicker.datePickerMode = .DateAndTime datePicker.date = NSDate() datePicker.addTarget(self,action: "datePickerValueChange:",forControlEvents: .ValueChanged) self.vIEw.addSubvIEw(datePicker) } overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning() // dispose of any resources that can be recreated. } /// 响应 datePicker 事件 func datePickerValueChange(sender: UIDatePicker) { println("value change: \(sender.date)") }}------------------------------------------------------------------------------------------
GitHub 上项目地址:UIDatePickerSample
控件更多相关属性及方法参考:UIDatePicker Class Reference 文章最后更新时间:2015年4月3日11:18:10 总结
以上是内存溢出为你收集整理的Swift 简单控件示例:日期选择器(UIDatePicker)全部内容,希望文章能够帮你解决Swift 简单控件示例:日期选择器(UIDatePicker)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)