What does an ivar contain?
-
15-04-2021 - |
문제
in the header file, an ivar structure has three members:-
name, type and offset.
I guess name is for storing the name of the variable.
Offset is for storing distance in bytes from the start of the structure.
Please tell me if I am right about these two ? can anyone explain me What is type for ? Is it the datatype or the scope telling whether it is public ,private or protected.
해결책
It's a C string containing the instance variable's type encoding. See Type Encodings in your local copy of Objective-C Runtime Programming Guide.
You should not access Ivar
fields directly, though, because Ivar
is an opaque type. It's better to use ivar_getTypeEncoding()
for that.
제휴하지 않습니다 StackOverflow