在Obj-C/Storyboard中为两个子类共享相同的UI [英] Share the same UI for two subclasses in Obj-C/Storyboard

查看:81
本文介绍了在Obj-C/Storyboard中为两个子类共享相同的UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ViewControllerA,其UI布局是在Interface Builder(故事板)中设计的.

I have a ViewControllerA, and its UI layout is designed in the Interface Builder (storyboard).

ViewControllerA有两个具体的子类,ViewControllerB1ViewControllerB2;它们具有与其父类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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆