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 protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]