View Single Post

Member Since: May 02, 2009
Posts: 480
wmprice1240 has a spectacular aura about
Mac Specs: MBP 2.33 4GB: MacPro 8 Core 2.8, 16GB: MacMini 2.26 4GB: MacMin 2.53 4GB: iPhone3GS 32GB

wmprice1240 is offline
NSString* Variable2 = @"This is Variable 2 String.";
This would be considered the 'correct' form, though both forms accomplish the same thing. The first approach is simply too verbose and the initializer provides nothing beyond what the direct initialization accomplishes.

I am very surprise that Variable2 just "knows" that it's a NSString, I figure it's smart enough to know that when the value assigns to it is of NSString type and it convert itself automatically
Actually, the language itself helps here. The '@' token essentially allows the compiler to do the necessary conversion from the character string to the NSString.
QUOTE Thanks