NSCalendar * gragortion = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSDateComponents * comp2 = [gragortion components:(NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit) fromDate:date];
NSInteger currentHour = [comp2 hour];
NSInteger currentMin = [comp2 minute];
int currentTotal = currentHour*3600 + currentMin*60;
int alarmToal = 7*3600 + 30* 60;
ontimer = alarmToal - currentTotal;
if(ontimer <0)ontimer = 24* 3600+ontimer;
UILocalNotification * notion = [[UILocalNotification alloc]init];
notion.fireDate = [NSDate dateWithTimeIntervalSinceNow:ontimer];
notion.repeatInterval = kCFCalendarUnitDay;
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
认证高级PHP讲师