Actually, you CAN restrict with a subclass. You can override whichever methods you want to block in your subclass's .h
file. You can make initWithFrame
unavailable by placing the following in your .h
file.
- (id) initWithFrame:(CGRect) frame __attribute__((unavailable("message")));
This will make the initWithFrame:
method unavailable to anyone using your subclass.
To keep other code form calling this method, you can further restrict by putting this in your .m
file.
- (id) initWithFrame:(CGRect) frame
{
return nil;
}