iOS method signature runtime type encodings

Table 6-1  Objective-C type encodings

Code

Meaning

 

c

char

 

i

An int

 

s

short

 

l

long

l is treated as a 32-bit quantity on 64-bit programs.

 

q

long long

encoding (Q) 

C

An unsigned char

 

I

An unsigned int

 

S

An unsigned short

 

L

An unsigned long

 

Q

An unsigned long long

 

f

float

 

d

double

 

B

A C++ bool or a C99 _Bool

 

v

void

 

*

A character string (char *)

 

@

An object (whether statically typed or typed id)

 encoding (@)

#

A class object (Class)

 

:

A method selector (SEL)

 

[array type] 

An array

 

{name=type...}

A structure

 

(name=type...)

A union

 

bnum

A bit field of num bits

 

^type

A pointer to type

 

?

An unknown type (among other things, this code is used for function pointers)

 

 

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100

 

posted @ 2020-07-26 13:01  Coding&Life  阅读(134)  评论(0)    收藏  举报