Hi all..
I am confused by thinking how/ when the dealloc in singleton instance get called?
Can any one tell me how to release a static object..
Say...
My code luks like below...
I am just calling [MyClass getMyClasObject].<anyProperty> to set teh values from different files...
However i wnat the data through out the application...
So how to release / dealloc the "staticMyClassObj" before quitting app...
I am confused by thinking how/ when the dealloc in singleton instance get called?
Can any one tell me how to release a static object..
Say...
My code luks like below...
Code:
// staticMyClassObj is a static-object
+(MyClass *)getMyClassObject
{
if(staticMyClassObj == nil)
{
staticMyClassObj = [[Catalog alloc]init];
staticMyClassObj.myClassDictionary = [[[NSMutableDictionary alloc] init]autorelease];
staticMyClassObj.itemsArray = [[[NSMutableArray alloc]init]autorelease];
}
return staticMyClassObj;
}
+(void)setMyClassObject:(MyClass *)MyClassObject
{
if(staticMyClassObj !=MyClassObject)
{
[staticMyClassObj release];
staticMyClassObj = [MyClassObject retain];
}
}
I am just calling [MyClass getMyClasObject].<anyProperty> to set teh values from different files...
However i wnat the data through out the application...
So how to release / dealloc the "staticMyClassObj" before quitting app...