static NSStrings in Objective-C
Posted
by MikeyWard
on Stack Overflow
See other posts from Stack Overflow
or by MikeyWard
Published on 2010-05-22T13:16:15Z
Indexed on
2010/05/22
13:20 UTC
Read the original article
Hit count: 194
objective-c
|nsstring
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~
© Stack Overflow or respective owner