lukaskollmer
Jul 26, 2016 - 21:22
Hi,
I'm creating a subclass of UITextView using create_new_class.
This subclass implements a couple of methods specific to UITextView.
How can I access/call super in these methods?
Hi,
I'm creating a subclass of UITextView using create_new_class.
This subclass implements a couple of methods specific to UITextView.
How can I access/call super in these methods?
This looks like something that objc_util doesn't natively support. The relevant declarations from Apple's Objective-C Runtime Reference are:
struct objc_super {
id receiver; // Object to which to send the message
Class class; // Superclass whose implementation should be used
};
id objc_msgSendSuper(struct objc_super *super, SEL op, ...);
void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...);
you should be able to copy the from ObjCInstanceMethod, and change the objc_class line:
class ObjCInstanceMethodSuperclass (object):
'''Wrapper for an Objective-C instance method. ObjCInstance generates these objects automatically when accessing an attribute, you typically don't need to use this class directly.'''
def __init__(self, obj, method_name, allow_property=True):
self.obj = obj
objc_class = obj.superclass() #modified!!
......
then create one manually.