• 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
Re: Newbie probably not retaining himself to well...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie probably not retaining himself to well...


  • Subject: Re: Newbie probably not retaining himself to well...
  • From: John Haager <email@hidden>
  • Date: Thu, 20 Jun 2002 08:46:57 -0700

On Wednesday, June 19, 2002, at 11:28 PM, Alexander Griekspoor wrote:

Hi all,

[ snip ]

/* set the startdate and immediately afterwards the "formatted" time
string*/

- (void)setStartdate: (NSCalendarDate*) value
{
[startdate autorelease];
startdate = [value copy];

if([startdate minuteOfHour] < 10){
starttime = [NSString stringWithFormat: @"%d:0%d",
[startdate hourOfDay], [startdate minuteOfHour]];
}
else{
starttime = [NSString stringWithFormat: @"%d:%d",
[startdate hourOfDay], [startdate minuteOfHour]];
}

NSLog(@"%@", starttime);
}

Using the convenience methods stringWithformat reutrns an autoreleased object to you. In order to keep this object, you need to retain it. For more info on retain/release/autorelease, I recommend checking out the StepWise article "Hold Me, Use Me, Free Me" (http://www.stepwise.com/Articles/Technical/HoldMe.html).

-> John Haager <-
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Newbie probably not retaining himself to well... (From: Alexander Griekspoor <email@hidden>)

  • Prev by Date: animation
  • Next by Date: Converting dfont files into "normal" TTF ones?
  • Previous by thread: Newbie probably not retaining himself to well...
  • Next by thread: Re: Newbie probably not retaining himself to well...
  • Index(es):
    • Date
    • Thread