在Obj-C/Storyboard中为两个子类共享相同的UI [英] Share the same UI for two subclasses in Obj-C/Storyboard
问题描述
我有一个ViewControllerA
,其UI布局是在Interface Builder(故事板)中设计的.
I have a ViewControllerA
, and its UI layout is designed in the Interface Builder (storyboard).
ViewControllerA
有两个具体的子类,ViewControllerB1
和ViewControllerB2
;它们具有与其父类ViewControllerA
相同的UI,但是以不同的逻辑运行.
ViewControllerA
has two concrete subclasses, ViewControllerB1
and ViewControllerB2
; they have the same UI with its superclass ViewControllerA
, but run with different logic.
如何创建两个不同的具体类,但它们与情节提要共享相同的UI,因此您必须在其中指示视图控制器的类?
How can I create two different concrete classes but they share the same UI with storyboard in which you must indicate the view controller's class?
推荐答案
不幸的是,故事板不支持子类化.
您应该在ViewControllerA
中为不同的逻辑创建委托.
Unfortunately storyboard doesn't support subclassing.
You should create delegate in ViewControllerA
for different logic.
这篇关于在Obj-C/Storyboard中为两个子类共享相同的UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!