In a ViewController
I have the following:
- (void)viewWillAppear:(BOOL)animated
{
DataObject *theDataObject = [self theAppDataObject];
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"MMM dd, yyyy HH:mm"];
NSString *dateStr = [formatter stringFromDate:theDataObject.deadline];
NSLog(@"Logged dateStr: %@", dateStr);
[dateTimeLabel setText:dateStr];
[super viewWillAppear:animated];
}
To clarify: dateTimeLabel
IS wired up in the xib
file. The viewWillAppear
method is explicitly called from another ViewController
, and is firing, like so:
- (IBAction)setDateTimeButtonClicked:(id)sender
{
DataObject *theDataObject = [self theAppDataObject];
theDataObject.deadline = [datePicker date];
FirstMobileViewController *mobileVC = [[FirstMobileViewController alloc] init];
[mobileVC viewWillAppear:YES];
[mobileVC release];
[UIView transitionWithView:self.view.superview
duration:0.5
options:UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionLayoutSubviews | UIViewAnimationOptionAllowAnimatedContent
animations:^{[self.view removeFromSuperview];}
completion:NULL];
}
The viewWillAppear
method is firing -- the dateStr
is logged by NSLog
appropriately when the superview is shown again. But the dateTimeLabel
never updates. Obviously, commenting the NSLog
line doesn't make a difference.
The MADDENING thing is that even though NSLog
logs dateStr
just fine, if I change dateStr
to, say, @"Yo!"
or even to a locally initialized string, then dateTimeLabel
will update, no problem.
What am I missing here?