Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
objc_util access `super`
-
Hi,
I'm creating a subclass of
UITextView
usingcreate_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.