Strange Behavior
Strange Behavior
- Subject: Strange Behavior
- From: MARC BLATT <email@hidden>
- Date: Fri, 5 Feb 2010 16:44:40 -0800
I have the following code in viewWillAppear: for my iPhone dev project (iPhone Development SDK Book, Chapter 4, p.63):
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.titleLabel.text = self.movie.title;
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
self.boxOfficeGrossLabel.text = [formatter stringFromNumber:self.movie.boxOfficeGross];
// [formatter release];
self.summaryLabel.text = self.movie.summary;
NSLog(@"%@ sold %@ because %@", self.movie.title, [formatter stringFromNumber:self.movie.boxOfficeGross], self.movie.summary);
NSLog(@"%@ sold %@ because %@", self.titleLabel.text, self.boxOfficeGrossLabel.text, self.summaryLabel.text);
[formatter release];
}
The Console displays the following NSLog statements:
2010-02-05 15:59:13.265 ... Inglorious Bastards sold $750,550,016.00 because Brad Pitt plays a great role with a terrible accent.
2010-02-05 15:59:13.266 ... (null) sold (null) because (null)
The first NSLog printout is correct and the second should be the same (i.e., the first (null) should read "Inglorious Bastards", the second (null) should read "$750,550,016.00", and the third (null) should read "Brad Pitt plays a great role with a terrible accent". All of the @property and @synthesize code entries are correct.
Why isn't the left side retaining the right side data. I know I must be missing something obvious.
BTW--The initWithTitle:boxOfficeGross:summary: is autoreleased.
Thanks in advance.
Marc_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden