各位多指教

解决方案 »

  1.   

    @"test"
    像这种???
    好像是类似指标的声明
      

  2.   


    放在一个字符串前面代表的是你这个字符串是NSString类型的。不放的话,就代表你这个字符串是C风格的字符串。
      

  3.   

    建议楼主先看一下关于Objective-c的资料先
      

  4.   

    3楼正解官方Learing Objective-C文档中的String部分有说到的
    ===
    The NSString class provides an object wrapper for strings that has all of the advantages you would expect, including built-in memory management for storing arbitrary-length strings, support for Unicode, printf-style formatting utilities, and more. Because such strings are used commonly though, Objective-C provides a shorthand notation for creating NSString objects from constant values. To use this shorthand, all you have to do is precede a normal, double-quoted string with the @ symbol
    ===地址:
    http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/
      

  5.   

    Objective-C是C语言的扩展,其中一项扩展就是Objective-C的字符串是NSString的对象。在C语言中,字符串就是指向以NULL字符结束的连续内存块的指针,区分C字符串常量和Objective-C字符串常量,就是看前面有没有@。如:
    // C字符串
    char *foo;
    //NSString
    NSString *bar;
    foo = "this is a C string";
    bar = @"this is an NSString";
    另外,还有一种情况。
    为了减少C代码和Objective-C代码之间的冲突,Objective-C的关键字都是使用@作为前缀。比如@end、@implementation、@class、@selector、@protocol、@property、@synthesize。