Creating UIViewController programmatically base on response json

本小妞迷上赌 提交于 2019-12-12 02:52:07

问题


Assume my json will be

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

And I gonna use PagingMenuController from this library : PagingMenuController

Base on the JSON which I described above, Category will be different,they may be 4 or 5,or more or less.So,Its dynamic.

This is how I gonna develope

As you can see,I will display CategoryID on PagingMenu.All the viewcontroller inside each page menu have common items :

UITableView,UIImageView,UIButton

So,how do i create UIViewController which have common items and actions on each view and insert to my page controller.I really need help with that.I don't know how to do it programatically.It was more like google play store app which page menu are created dynamically.

Any Help?Please,all my life,I used only storyboard and view controller.From now,I really need help.


回答1:


Go through following tutorial. It is in objective-c but it will help you to understand the logic.

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



来源:https://stackoverflow.com/questions/36441532/creating-uiviewcontroller-programmatically-base-on-response-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!