The NSDate in my first view Controller wont refresh until I go to another view controller and then come back to it. Any idea why that would be?
viewDidLoad:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(fadein) userInfo:nil repeats:NO];
[timer fire];
viewWillAppear:
// Date
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterFullStyle];
NSString *dateToday = [formatter stringFromDate:[NSDate date]];
[dateLabel setText:dateToday];
dateLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
Method:
-(void) fadein
{
dateLabel.alpha = 0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelay:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:1.0];
dateLabel.alpha = 1;
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView commitAnimations];
}
Thanks!
EDIT: Problem solved, thanks to the people below with helpful answers. Looks like other people that didn't give answers closed the question, but both people that gave answers below worked!