UITableView inside UITableViewCell in iOS

Posted on 2014-08-29
Last Modified: 2014-11-22
I want to create an layout in that i want to put UITableView(SubTableView) inside UITableViewCell of the first UITableView(MainTableView). The problem which I am facing is that when I call the Data Source method of MainTableView, then all the DataSource Method are initialised but when cellForRowAtIndexPath method is executed then my SubTableView in not calling it's DataSource Method for particular row of the MainTableView. Instead what it dose is that it calls the DataSource Method of MainTableView and then it calls the DataSource Method for the SubTableView. My concern is that I want to call DataSource Method for SubTableView when cellForRowAtIndexPath method is executed for the MainTableView for particular row.This is the Layout which I need to create in that there is MainTableView having two views inside one row and in first view it has SubTableView.
Question by:dotsandcoms
    1 Comment
    LVL 14

    Accepted Solution

    In this method:
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    if (tableView == MainTableView)
    <Prepare cells for the main table>
    Prepare cells for your subtables.

    Generally speaking, I think you are not taking the right approach. Usually, loading a tableView inside a tableviewcell is not the best way to go with. Instead I suggest you to use UIScrollView inside each tableviewcell, especially if you want to load a limited number of views inside each cell.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Join & Write a Comment

    Ever wanted to watch videos in your computer from the bed without the need of standing up and shutting down the computer?  Is your computers operating system Windows XP, Windows Vista or Windows 7?  Do you own a iOS device? If all the answers were y…
    iPad in the Business – Quick Start Part 1 Getting Started with Active Sync Mail Many people seem to have issues connecting their iOS device to their company Exchange Server and this article covers the steps for Active Sync configuration as wel…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now