zoukankan      html  css  js  c++  java
  • 关于设置日期的代码

    在开发过程中,设置日期是必不可少的:

    //获取用户选择的时间
        NSDate *date = self.dataPicker.date;
        //把NSdat转换成一个字符串
        NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
        formatter.dateFormat = @"HH:mm";
        NSString *strDate = [formatter//把用户选择的日期设置给当前选中的cell中的label
        //获取用户当前选中的cell
        //根据当前选中行获取当前选中行的索引
        NSIndexPath *index = [self.tableView indexPathForSelectedRow];
        //根据当前选中索引获取当前选中的cell
        UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:index];
        
        //把日期设置给cell中的label
        cell.detailTextLabel.text = strDate;
  • 相关阅读:
    [Heoi2013]Alo
    10.24 考试
    第八周作业
    第七周作业
    第六周作业
    第五周作业
    第四周作业
    求最大值及其下标
    查找整数
    抓老鼠啊~亏了还是赚了?
  • 原文地址:https://www.cnblogs.com/ZMiOS/p/5026058.html
Copyright © 2011-2022 走看看