最終更新:2013-05-22 (水) 04:27:44 (1643d)  

Objective-C/リテラル はてなブックマークを見る
Top / Objective-C / リテラル

NSString

NSString *someString = @"Hello, World!";

NSString *someString = [NSString stringWithCString:"Hello, World!" encoding:NSUTF8StringEncoding];

と同等。

  • which is assumed to be ‘\0’-terminated and UTF-8 encoded
  • There has been support for Unicode in constant @"" NSStrings since Xcode 3.0?
  • Prior to Xcode 3.0?, GCC only supported the use of ASCII characters (i.e., characters ≤ 127) in constant NSString literals

Xcode 4.4以降

NSNumber

NSArray @[ ]

  • NSArray *gronk = @[ @"hi", @"bork", @23, @YES ];

NSDictionary @{ }

  • NSDictionary *splunge = @{ @"hi" :  @"bork", @"greeble" :  @"bork" };

関連

参考