I have a UIViewController
that needs to set a few labels when it receives a new (object) value for one of its properties:
-(void)setCurrentEvent:(Event *)e {
[currentEvent release];
currentEvent = [e retain];
self.dateLabel.text = currentEvent.subtitle;
self.summaryTextView.text = currentEvent.summary;
self.avgRatingLabel.text = [NSString stringWithFormat:@"%.1f",currentEvent.avgRating];
[self setTitle:currentEvent.title];
[self.view setNeedsDisplay];
}
I found that when the values are set for the first time, the label and text view objects are not initialized yet and thus their new values are not set. After the initial call of setCurrentEvent
all goes well, but I think I am relying on lazy loading a bit too much here?