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: Alexander Griekspoor <email@hidden>
- Date: Thu, 20 Jun 2002 09:48:03 +0200
>
> [NSString stringWithFormat: @"%d:0%d {snip}
>
>
this method returns an autoreleased NSString.
>
>
if the method you use to get it says "alloc" or "copy" -- you're sending a
>
retain message. otherwise in cases like this, it's autoreleased.
>
>
fillup
>
Aha, that makes sense... So I changed:
>
> if([startdate minuteOfHour] < 10){
>
> starttime = [NSString stringWithFormat: @"%d:0%d",
>
> [startdate hourOfDay], [startdate minuteOfHour]];
>
> }
into:
if([startdate minuteOfHour] < 10){
starttime = [[NSString alloc] initWithString: [NSString
stringWithFormat: @"%d:0%d",
[startdate hourOfDay], [startdate minuteOfHour]]];
}
With removal of the alloc/init of starttime in the init method.
If you have any suggestions on a better or more elegant way, please tell me,
but yes it works perfectly!!!! Thanks a lot. A happy newbie...
Alex
_______________________________________________
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.