static NSStrings in Objective-C
- by MikeyWard
I frequently see a code snippet like this in class instance methods:
static NSString *myString = @"This is a string.";
I can't seem to figure out why this works. Is this simply the objc equivalent of a #define that's limited to the method's scope? I (think) I understand the static nature of the variable, but more specifically about NSStrings, why isn't it being alloc'd, init'd?
Thanks~