开发者

How to subclass the NSObject while getting rid of -(id)init?

开发者 https://www.devze.com 2023-01-15 02:46 出处:网络
I want a class that take a REQUIRED argument开发者_StackOverflow社区 like the UITableViewController that does not have init.

I want a class that take a REQUIRED argument开发者_StackOverflow社区 like the UITableViewController that does not have init.

Currently I just throw an exception when invoking init.

Is there a way to deactivate it completely?


No. Just redefine it to some error condition. This is bad style anyway and I question your motives.


A non-existant method (anywhere in the class hierarchy) for any object would cause the runtime to throw an exception. If that's what you mean by a deactivated method, and you're throwing an exception already, then you're already done.

0

精彩评论

暂无评论...
验证码 换一张
取 消