I have a subclass of UIView, that have inherited the - initWithFrame: method. However, I don’t want that method to be called on my subclass.
Is there any way to “delete” that method on my subclass?
I have a subclass of UIView , that have inherited the – initWithFrame: method.
Share
Don’t implement it and don’t call
[super initWithFrame:aRect]. Just calldoesNotRecognizeSelector:with the_cmdargument:If the method does not return
void, you will receive a warning from the compiler:To “remove” this warning, add
return self;(in this case) as the last line to make the compiler happy. It will never be reached at runtime becausedoesNotRecognizeSelector:raises aNSInvalidArgumentExceptionexception.