美文网首页
iOS-UIDatePicker 日期时间选择器

iOS-UIDatePicker 日期时间选择器

作者: 我是谁重要吗 | 来源:发表于2018-03-21 21:58 被阅读26次
    //星期 月日 时分 上下午
    UIDatePicker *dk = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 20, 320, 200)];
        [self.view addSubview:dk];
        //四种 类型 
        dk.datePickerMode = UIDatePickerModeCountDownTimer;
    /*
        UIDatePickerModeTime,           // Displays hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. 6 | 53 | PM)
        UIDatePickerModeDate,           // Displays month, day, and year depending on the locale setting (e.g. November | 15 | 2007)
        UIDatePickerModeDateAndTime,    // Displays date, hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. Wed Nov 15 | 6 | 53 | PM)
        UIDatePickerModeCountDownTimer, // Displays hour and minute (e.g. 1 | 53)
     */   
     dk.minuteInterval = 5;//被60整除的数 显示时间间隔
     
     dk.minimumDate = //NSDate  最小时间
     //NSDate* minDate = [[NSDate alloc]initWithString:@"1900-01-01 00:00:00 -0500"];
        dk.maximumDate =   //NSDate  最大时间
        
        dk.date =  //设置默认显示日期
        //添加事件
        [dk addTarget:self action:@selector(clickDatePicker:) forControlEvents:UIControlEventValueChanged];
    

    相关文章

      网友评论

          本文标题:iOS-UIDatePicker 日期时间选择器

          本文链接:https://www.haomeiwen.com/subject/ekwnqftx.html