Мне нужно иметь возможность проверить, выпустил ли я уже переменную в target-c. Я попытался проверить, изменилось ли оно на ноль:
//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
Есть ли более простой способ проверить, освобожден ли он?