gpt4 book ai didi

swift - 基于响应 json 以编程方式创建 UIViewController

转载 作者:行者123 更新时间:2023-11-30 13:32:19 24 4
gpt4 key购买 nike

假设我的 json 是

{
{"CategoryID" : "1 Month Premium"},
{"CategoryID" : "1 Year Premium"},
{"CategoryID" : "1 Week Premium"},
{"CategoryID" : "1 Day Premium"},
....Dynamically created server data.
}

我将使用这个库中的 PagingMenuController :PagingMenuController

基于我上面描述的JSON,类别会有所不同,它们可能是4个或5个,或多或少。所以,它是动态的。

这就是我要发展的方式

enter image description here

如您所见,我将在 PagingMenu 上显示 CategoryID。每个页面菜单内的所有 View Controller 都有公共(public)项目:

UITableView、UIImageView、UIButton

那么,我如何创建 UIViewController,它在每个 View 上都有通用的项目和操作,并插入到我的页面 Controller 中。我真的需要帮助。我不知道如何以编程方式完成它。它更像是 google play存储应用程序的页面菜单是动态创建的。

有什么帮助吗?拜托,我一生中只使用 Storyboard和 View Controller 。从现在开始,我真的需要帮助。

最佳答案

完成以下教程。它是用 Objective-C 编写的,但它会帮助你理解逻辑。

http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/

关于swift - 基于响应 json 以编程方式创建 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36441532/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com