static NSStrings in Objective-C
问题 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~ 回答1: For the part of NSString alloc, init: I think first, it can be thought as a convenience, but it is not