1
我试图比较UIDatePickers
选择时间与当前时间。我希望比较UIDatePickers
选择的时间与当前设备上的时间。这是我所尝试过的,但并不准确。试图将日期选择器时间与当前时间进行比较ios
NSDate * date = [NSDate date];
NSLog(@"DatePicker.date %@ <= date %@",self.DatePicker.date,date);
if (self.DatePicker.date<=date) {
UIAlertView * alert=[[UIAlertView alloc] initWithTitle:@"Oops!" message:@"Choose a time in the future." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
return;
}
然后它退出;
self.DatePicker.date 2014-09-12 15:15:00 +0000 <= date 2014-09-12 15:03:29 +0000
,并显示AlertView
这个时钟似乎是一个小时关闭也。
感谢您的支持! – DevC 2014-09-12 15:33:05