Objective-C Runtime: What to put for size & alignment for class_addIvar?
问题 The Objective-C Runtime provides the class_addIvar C function: BOOL class_addIvar(Class cls, const char *name, size_t size, uint8_t alignment, const char *types) What do I put for size and alignment ? I'm adding an instance variable of type UITextPosition * , but no UITextPosition object is in scope. For size , can I just do sizeof(self) , where self is a subclass of UITextField ? I.e., can I assume that a UITextPosition object is the same size as a UITextField object? How do I get alignment