Мне нужно иметь возможность проверить если я уже выпустил переменную в объекте-c. Я попытался проверить, не изменился ли он на null:
//Checks if buildview is null and returns respective output
if(BuildView == NULL)
NSLog(@"Build View Value (pointer): Null");
else
NSLog(@"Build View Value (pointer): Not Null");
//allocates memory and initalizes value
BuildView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
//Checks if buildview is null and returns respective output again
if(BuildView == NULL)
NSLog(@"Build View Value (pointer): Null");
else
NSLog(@"Build View Value (pointer): Not Null");
//Releases the view
[BuildView release];
//Checks if buildview is null and returns respective output again
if(BuildView == NULL)
NSLog(@"Build View Value (pointer): Null");
else
NSLog(@"Build View Value (pointer): Not Null");
Результаты были:
Build View Value (pointer): Null
Build View Value (pointer): Not Null
Build View Value (pointer): Not Null
Есть ли более простой способ проверить, освобожден ли он?