Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 108', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | @defs className Takes the name of an Objective-C class and evaluates to a sequence of type declarations that duplicate the field declarations of the class. This directive can appear only in a C structure declaration. @protocol ProtocolName Evaluates to a pointer to an instance of the Protocol class. You need this because you can t get a protocol class instance by using the protocol name directly as you can with a class object. @selector MethodName Evaluates to a SEL representing the specified method. @ string A shorthand for creating a string literal that s an instance of a user-defined string class. Use this when you need a string object constant. The directives @encode @defs and @ string deserve some additional explanation. 1.4.3.1 Using @encode The following example shows how @ encode can be used to get the string that the Objective-C runtime uses to describe a type char itype @encode int The result of this statement will be to define i type as the one-character string i which is the runtime representation of an int type. The @encode directive can take any C or Objective-C type. The runtime uses the mapping between types and strings to encode the signatures of methods and associate them with selectors. You can use @encode to implement your own object storage and retrieval or other tasks that need to describe the types of values. Table 1-1 shows the results of applying @encode to C and Objective-C types. Table 1-1. Types and their encodings Type @encode type char c int i short s long l long long q unsigned char C unsigned int i unsigned short S unsigned long L unsigned long long Q float f double d void v char An object pointer @ Class SEL An array of N elements of type Ntype A structure called name with elements t1 t2 etc. name t112. A union type . A bit field of size N bN A pointer to type type Unknown type The runtime system also uses encodings for type qualifiers shown in Table 1-2 and you may encounter them in its representation of method signatures. However