• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strange Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Strange Behavior
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Wrong placement with -[NSWindow initWithContentRect:styleMask:backing:defer:screen:]
  • Next by Date: Unable to add list to an entity
  • Previous by thread: Re: Wrong placement with -[NSWindow initWithContentRect:styleMask:backing:defer:screen:]
  • Next by thread: Re: Strange Behavior
  • Index(es):
    • Date
    • Thread