How to prevent usage of other init methods other than my custom method in Objective-C

后端 未结 2 1747
小蘑菇
小蘑菇 2021-01-16 12:25

Background - in my iPhone app I have a custom UITableViewController - I was going to pass some required config to it by extending the existing \"(id)initWithStyle:(UITableVi

2条回答
  •  粉色の甜心
    2021-01-16 12:36

    You can override the init methods that you don't want to be used, and raise an exception there.

    You can also override them and make them initialize with the designated initializer.

    Also, you should specify it on your documentation.

提交回复
热议问题