Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITableView(UITableViewCell)中的UITableView_Ios_Objective C_Uitableview_Parse Platform - Fatal编程技术网

Ios UITableView(UITableViewCell)中的UITableView

Ios UITableView(UITableViewCell)中的UITableView,ios,objective-c,uitableview,parse-platform,Ios,Objective C,Uitableview,Parse Platform,场景 我有一个应用程序可以让用户发帖,这些帖子会显示在UITableView中。其他用户的将有能力评论其他用户的帖子。因此,我想添加另一个UITableView来显示每个帖子的评论 仅回顾一下 这是一个包含一个UITableViewCell的UITableView,而该UITableViewCell将包含另一个UITableView。实际上是PFTableViewCell,因为我使用的是parse.com框架,但都是一样的 (我自己一想到这件事就感到很困惑。这就是我下一部分的内容。) 问题 我真

场景

我有一个应用程序可以让用户发帖,这些帖子会显示在UITableView中。其他用户的将有能力评论其他用户的帖子。因此,我想添加另一个UITableView来显示每个帖子的评论

仅回顾一下

这是一个包含一个UITableViewCell的UITableView,而该UITableViewCell将包含另一个UITableView。实际上是PFTableViewCell,因为我使用的是parse.com框架,但都是一样的

(我自己一想到这件事就感到很困惑。这就是我下一部分的内容。)

问题

我真的不知道该怎么想。这就像是一座镜子之屋,每面镜子都在看着另一面镜子,创造出一种无尽的混乱和幻觉

我已经在这里走动了

//the "top" view controller

-(PFTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {

    //I do all of my cell config here
    PostTableViewCell *cell;

    /* THIS IS WHERE IM LOST!
       In the "cell" I just made I have a UITableView set up
       with the delegate methods and everything, including
       an NSArray property called "comments". So, am I 
       supposed to do something like this?...
    */

    //Query for Comments
    PFQuery *commentsQuery = [PFQuery queryWithClassName:@"Comment"];
    [commentsQuery whereKey:@"parentID" equalTo:object.objectId];
    [commentsQuery orderByDescending:@"createdAt"];
    [commentsQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

        /* maybe?
        [cell.commentTableView cellForRowAtIndexPath:indexPath];
        [cell.commentTableView numberOfRowsInSection:objects.count];
         */

        cell.comments = objects;

        /* And then in the PostTableViewCell file in it's
           table view methods am I supposed to use the
           "comments" property as the data source? If so, I
           have not been able to successfully do this it NSLogs
           "(null)"
        */

    }];

}
**总结*


正如你所看到的,仅仅是我在伪代码中询问了“也许?”的注释,我真的很迷茫。我当然希望这一切都能为我编码出来,但如果有人能向我解释实现这一目标的过程,我也会非常感激。谢谢。

我想你是想做一些会弄得一团糟的事情。您对评论深度有限制吗?例如,用户可以对一条评论进行评论,而该评论是对另一条评论的评论?我认为您最好只是更好地管理您的数据,并使用一个带有多种自定义样式的
UITableViewCell
UITableView
来实现这一点。不,它不会有注释深度上的注释。但是使用多种样式的自定义UITableViewCells更好是什么意思呢?创建两个自定义单元格,一个用于原始帖子,一个用于评论。您的注释单元格可以有不同的布局/样式。或者可以考虑使用
UICollectionView