How to populate UITableView with the responce of JSON from a different ViewController?

后端 未结 1 1468
执笔经年
执笔经年 2021-01-26 04:33

I googled and searched in stackoverflow.com but couldn\'t get rid of this situation, how can i populate TableView with the responce of a GET. I send the GET and parse the respon

1条回答
  •  一个人的身影
    2021-01-26 05:08

    You have several issues I found just by taking a quick look: 1. You have an instance of UITableViewController. The proper initialization for a UITableViewController is initWithStyle: Use that instead. Otherwise you need to do some extra work, and it's really not needed. 2. You are checking the strings from the buttons in your UIAlertView instance. My recommandation is not to do that. Strings are somehow volatile. Multi language can be inserted as a feature and you can have issues after that. Check the index instead. It's a simple int, not headaches alert ! 3. You have setted your NSMutableArray as a property in your messages class. Why don't you populate it. That's why the information isn't appearing in your table: because you are not providing it to the specific class. From the controller you are initializing the controller (class that contains the table view), provide its content from the original controller.

    Advices: 4. For standardization, name your classes with capital letters and your variables with small ones. Constants should begin with "k" letter.

    0 讨论(0)
提交回复
热议问题