我想知道我怎样才能列出从星期一到星期日的日子......
我这样做了:
- (NSString *) stringWithDayNameOf:(int)day {
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"D"];
NSDate *date = [dateFormat dateFromString:[NSString stringWithFormat:@"%i", day]];
[dateFormat setDateFormat:@"eeee"];
NSString* outer = [dateFormat stringFromDate:date];
outer = [outer uppercaseString];
return outer;
}
for (int i = 1; i <= 7; i++) {
NSLog(@"DAY: %@", [self stringWithDayNameOf:i]);
}
但它显示了从今天开始的几天......如何解决这个问题或让它变得更简单?
谢谢!!