//星期 月日 时分 上下午 
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];

发布评论
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!

UIPickerView 滚动选择器详解
你是第一个吃螃蟹的人
发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。