Release static int variable
How to "clean" static int variables in a view class method? Every time a get back to this view I need those vars "zeroed". The [self.view removeFromSu开发者_运维百科perview];
instruction does not seem enough to free up memory from those vars.
Thank you. Have a great 2010!
These int vars are declared static in a view method. They are not global in the view class.
If you don't want a static value to stick around, don't make it static.
You'll have to manually do this by defining a setValue method similar to:
@interface MyClass
{
// ...
}
+ (NSString *)myVar;
+ (void)setMyVar:(NSString *)newVa;
@end
@implementation MyClass
static NSString *myVar;
+ (NSString *)myVar { return myVar; }
+ (void)setMyVar:(NSString *)newVar { myVar = newVar; }
@end
精彩评论