0
週の特定の日にカウントダウンをコーディングしようとしています。 現在の平日と残りの秒を水曜日に表示します。特定の曜日に秒単位でカウントダウンする
私は最初の部分をコーディングすることができますが、半日後に解決策を探しても、2番目の部分は処理できません。 NSDateとNSDateFormatterクラスの両方で
- (void)viewDidLoad {
[countdownLabel setFont:[UIFont fontWithName:@"Helvetica" size:128.0]];
countdownLabel.text = @"What day ist it?";
[super viewDidLoad];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[super dealloc];
}
-(void)updateLabel {
NSDateFormatter* theDateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[theDateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[theDateFormatter setDateFormat:@"EEEE"];
countdownLabel.text = [theDateFormatter stringFromDate:[NSDate date]];
}
ありがとう、私はすでにそれをしました。私の問題は、私は翌年の新年にカウントダウンすることができるということです。しかし、週の特定の日にカウントダウンしたいので、週の任意の日から、私は失われています。 –