Yes, this is possible with the help of an extension of a private class.
Example 1
Superclass.h
@interface Superclass : UIViewController @end
Superclass.m
@interface Superclass()<UITableViewDelegate, UITableViewDataSource> @end @implementation Superclass // implement interface methods @end
Subclass.h
@interface Subclass : Superclass<UITableViewDelegate, UITableViewDataSource> @end
After taking another step, you can move the extension of the private class to the private header Superclass + Private.h, then your other inner classes may know that it also implements them.
Example 2
Superclass + Private.h
#import "Superclass.h" @interface Superclass()<UITableViewDelegate, UITableViewDataSource> @end
Superclass.m
#import "Superclass+Private.h> @implementation Superclass // implement interface methods @end
Note There is a limitation on the fact that this method does not allow you to override and call the super in method, which does not correspond to a subclass of your superclass. For these methods, I would recommend the UIGestureRecogniser subclass template.
source share