是否可以让多个UIViewControllers相互继承,只让最后一个有一个nib文件?

时间:2022-05-14 15:00:19

I am trying to implement a UIViewController hirarchy where the top most UIView Controller implements just a few basic methods the second level view controller a few more methods (depending on which one it is) and the last one on the third level has some more customized methods and also a nib file whereas none of the UIView Controller on level one and two have nibs.

我正在尝试实现一个UIViewController hirarchy,其中最顶层的UIView Controller实现了一些基本方法,第二级视图控制器还有一些方法(取决于它是哪一个),而第三级上的最后一个方法有一些更自定义的方法还有一个nib文件,而第一级和第二级的UIView控制器都没有nib。

Now I was wondering whether this is a good approach. So far it seems to work just fine.

现在我想知道这是否是一个好方法。到目前为止似乎工作得很好。

Cheers, Andy

干杯,安迪

1 个解决方案

#1


0  

It should work fine. Inheritance is great! If any of your views ever deviate too much, you can override methods or pull them out of the hierarchy to customize.

它应该工作正常。传承很棒!如果您的任何视图偏离太多,您可以覆盖方法或将它们从层次结构中拉出来进行自定义。

#1


0  

It should work fine. Inheritance is great! If any of your views ever deviate too much, you can override methods or pull them out of the hierarchy to customize.

它应该工作正常。传承很棒!如果您的任何视图偏离太多,您可以覆盖方法或将它们从层次结构中拉出来进行自定义。