title: How to implement a tableview inside a custom tableview cell?
body: <p>I am new to Objective-C and Xcode. I used to write C programs before, so I am encountering many problems using Xcode.</p>
  
  <p>Now, I am writing an app like "instagram" that shows image and related comments.  All these images and comments are from database, which is not important in my question.</p>
  
  <p>So, please have a look at my design. 
  <a href="http://i.stack.imgur.com/KsF76.png" rel="nofollow">Click me</a></p>
  
  <p>This is "one cell setting", at which the apps will keep showing different image and comment while scrolling down and display the another cells.</p>
  
  <p>Firstly, I create a <code>UITableViewController</code>, then I enlarge the table view cell to whole view. And I add an <code>UIImageView</code> and table view "onto" the cell, thus, this is a custom cell.</p>
  
  <p>Then I create a <code>UITableViewCell</code> class to implement this custom cell. I search and found that I can add a subview in this <code>UITableViewCell</code> class to show the <code>UIImage</code> in my custom cell like:</p>
  
  <pre><code>UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(cell.contentView.frame.origin.x,     cell.contentView.frame.size.height, 20, 20)];
  imageView.image = [UIImage imageNamed:@"Icon.png"];
  [cell.contentView addSubview:imageView];
  </code></pre>
  
  <p>But I can't figure out how to add a <code>UITableView</code> as a subview of my custom cell. Say, I can add a code</p>
  
  <pre><code>[cell.contentView addSubView:tableView] ;
  </code></pre>
  
  <p>onto my custom cell class, but where can I config the cell contents of this embedded <code>TableView</code>? Thus this method:</p>
  
  <pre><code>-(UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath ;
  </code></pre>
  
  <p><strong>So, can someone suggest how can I achieve this? Or there is another approach that can achieve the goal? Thanks for the help.</strong></p>