Re: Newbie probably not retaining himself to well...
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.