如何使用界面生成器动态更改视图控制器的类 [英] How to change class dynamically for view controller using interface builder

查看:79
本文介绍了如何使用界面生成器动态更改视图控制器的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同一设计文件有不同的条件.我不能在同一个类文件中使用if-else来区分它们.因为管理所有条件都很困难.有什么办法可以在动态时间更改课程.

there are different conditions for same design file. i can't use if-else in same class file to differentiate them. because manage all conditions are difficult. is there any way to change class at dynamic time.

推荐答案

是的,我们可以使用Xib设置类.但是从我的研究中,我没有找到任何动态更改故事板类的方法.我找到了其他方法来重用视图,例如使用容器视图.以下链接显示了如何重用情节提要视图. 迭戈·拉瓦勒(Diego Lavalle)在媒介上对其进行了描述.

Yes, we can set class using Xib. But from my research i didn't find any way to change storyboard class dynamically. I found other way to reuse the view like using container view. following link shows how can we reuse storyboard view. Diego Lavalle describe it on medium.

,您可以在此处.

这篇关于如何使用界面生成器动态更改视图控制器的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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