Dear Y'all -
I have a tab bar app in which one view allows setting a date value and another view should display information (i.e. UILabel.text) derived from the selected date. Things work fine except I have to quit the app for the information to update based on changes in the setting. The information is updated within viewDidLoad; what I want is something like viewDidLoad for the display view controller except executed each time that view is visited. I tried viewWillAppear to no avail.
Code in display view is:
I have a tab bar app in which one view allows setting a date value and another view should display information (i.e. UILabel.text) derived from the selected date. Things work fine except I have to quit the app for the information to update based on changes in the setting. The information is updated within viewDidLoad; what I want is something like viewDidLoad for the display view controller except executed each time that view is visited. I tried viewWillAppear to no avail.
Code in display view is:
Code:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *filePath = [self dataFilePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
NSArray *array = [[NSArray alloc] initWithContentsOfFile:filePath];
NSDate *soberDate = [array objectAtIndex:0];
dayCount.text = [NSString stringWithFormat:@"%g",
floor(([soberDate timeIntervalSinceNow] / (24*60*60)) * -1) + 2 ];
[soberDate release];
[array release];
}
// [filePath release];
}