寫了一個應用:
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Icon Contest!"
message:@"Design a 1024 x 1024 pixels icon for Example. The best one will be on the app's icon! Send them to: [email protected]."
delegate:self
cancelButtonTitle:@"More Info"
otherButtonTitles:@"Yes",@"No", nil];
[alert show];
其中有最後期限,然後在一月31號結束時應用顯示不同的警報。
我認為你應該看看NSDate的-timeIntervalSinceNow
方法,可以這樣:
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:31];
[comps setMonth:1];
[comps setYear:2013];
NSDate *date = [[NSCalendar currentCalendar] dateFromComponents:comps];
if ([date timeIntervalSinceNow] < 0.0) {
//已過日期
}
else {
//未過日期
}