Skip to content

Commit

Permalink
Cleaned up the date display in the refresh cells on the home screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
capttaco committed May 4, 2010
1 parent fa7a742 commit 4c1dd96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Classes/BFConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ + (UIColor *)separatorColorForTableView

+ (NSString *)shortDateStringFromDate:(NSDate *)date;
{
if (date == nil) return @"";

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
Expand All @@ -42,6 +44,8 @@ + (NSString *)shortDateStringFromDate:(NSDate *)date;

+ (NSString *)shortTimeStringFromDate:(NSDate *)date
{
if (date == nil) return @"";

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
Expand Down
11 changes: 10 additions & 1 deletion Classes/BFRefreshBriefCellController.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexP
}

name.text = [self.brief title];
desc.text = [NSString stringWithFormat:@"%@ scenes, last opened %@",

// check for null date
if (self.brief.dateLastOpened == nil)
desc.text = [NSString stringWithFormat:@"%@ scenes, never been opened", self.brief.totalNumberOfScenes];

else
desc.text = [NSString stringWithFormat:@"%@ scenes, last opened %@",
self.brief.totalNumberOfScenes, [BFConfig shortDateStringFromDate:self.brief.dateLastOpened]];


Expand Down Expand Up @@ -172,6 +178,9 @@ - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexP

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.brief setDateLastOpened:[NSDate date]];
[[BFDataManager sharedBFDataManager] save];

NSString *pathToDictionary = [[[BFDataManager sharedBFDataManager] documentDirectory] stringByAppendingPathComponent:[self.brief filePath]];
BFSceneManager *manager = [[BFSceneManager alloc] initWithPathToDictionary:pathToDictionary];
BFSceneViewController *sceneController = [[BFSceneViewController alloc] initWithSceneManager:manager];
Expand Down

0 comments on commit 4c1dd96

Please sign in to comment.