Commit 826ca8ae authored by zhangguangyi's avatar zhangguangyi

update time

parent a7976e2b
No preview for this file type
......@@ -160,10 +160,22 @@
pickerView.dataSource = self;
pickerView.backgroundColor = [UIColor whiteColor];
NSDate *currentDate = [NSDate date];
NSCalendar *currentCalendar = [NSCalendar currentCalendar];
NSUInteger integer = NSCalendarUnitYear | NSCalendarUnitMonth |NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents *dataCom = [currentCalendar components:integer fromDate:currentDate];
NSInteger hour = [dataCom hour];
NSInteger minute = [dataCom minute];
//设置pickerView默认第一行 这里也可默认选中其他行 修改selectRow即可
[pickerView selectRow:0 inComponent:0 animated:YES];
[pickerView selectRow:0 inComponent:1 animated:YES];
if (hour < 24 && minute < 60) {
[pickerView selectRow:hour inComponent:0 animated:YES];
[pickerView selectRow:minute inComponent:1 animated:YES];
selectedHour = hourArray[hour];
selectedMin = minArray[minute];
}else{
[pickerView selectRow:0 inComponent:0 animated:YES];
[pickerView selectRow:0 inComponent:1 animated:YES];
}
[contentView addSubview:pickerView];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment