다운로드 관리자가 내장 된 앱이 있습니다. 파일을 다운로드하면 문서 폴더 안의 폴더에 저장됩니다. 이제 테이블 뷰 셀에 시간 및 날짜 스탬프를 구현했습니다. 그러나 한 뷰 컨트롤러에서 내 테이블 뷰로 다시 전환하면 시간과 날짜가 현재 시간으로 업데이트됩니다.타임 스탬프가 계속 계산됩니다.
아래 코드는 제가 작업하고있는 코드이며 항상 도움이 될 것입니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } //did the subtitle style
NSUInteger row = [indexPath row];
cell.textLabel.text = [directoryContents objectAtIndex:row];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEE, MMM/d/yyyy, hh:mm aaa"];
NSDate *date = nil;
if (indexPath.row == 0)
{
date = [NSDate date];
NSString *dateString = [dateFormatter stringFromDate:date];
cell.detailTextLabel.text = dateString;
}
return cell;
}
+1 좋은 해결책 제안 –
내 다운로드 관리자에서 설정 한 경우 내 테이블보기에 어떻게 표시 되나요? 도움이된다면 HCDownload를 사용하여 파일을 다운로드하고 있습니다. – ChrisOSX