0
我正在嘗試在本週的某個特定日期進行倒計時。 我想顯示當前的工作日和週三剩餘的秒數。以秒爲單位倒數到特定的工作日
我可以對第一部分進行編碼,但即使在半天搜索解決方案後,我也無法處理第二部分。
這是我現在有:
- (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]];
}
謝謝,我已經做到了。我的問題是,我可以編碼到明年的新年倒計時。但是因爲我想在本週的某一天倒數到某一天,所以從本週的任何一天起,我都會迷失方向。 –