码迷,mamicode.com
首页 > 移动开发 > 详细

日期时间的选择器ios源码

时间:2014-11-21 09:11:02      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:des   style   http   io   ar   os   使用   sp   for   

这个源码案例是一个日期时间的选择器,源码DVDatePickerTableViewCell,DVDatePickerTableViewCell是使用Swift写的cell。可以在tebleView中提供一个日期时间的选择器,并持续显示在Cell上。
效果图:
  • <ignore_js_op>bubuko.com,布布扣 

使用方法:


DVDatePickerTableViewCell想平常使用cell那样使用即可。 
var cells:NSArray = [] 
cells = [[DVDatePickerTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: nil)]] 

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
        return cells[indexPath.section][indexPath.row] as UITableViewCell 
    } 
     
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 
         
        var cell = self.tableView(tableView, cellForRowAtIndexPath: indexPath) 
        if (cell.isKindOfClass(DVDatePickerTableViewCell)) { 
            var datePickerTableViewCell = cell as DVDatePickerTableViewCell 
            datePickerTableViewCell.selectedInTableView(tableView) 
        } 
         
        self.tableView.deselectRowAtIndexPath(indexPath, animated: true) 
    } 

日期时间的选择器ios源码

标签:des   style   http   io   ar   os   使用   sp   for   

原文地址:http://www.cnblogs.com/baidulianweikjj/p/4112002.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!