Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6562443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:42:34+00:00 2026-05-25T13:42:34+00:00

I need to present my table view with a two column list. I read

  • 0

I need to present my table view with a two column list. I read some related posts about making some grid by overriding drawRect (here). However, I’m seeking a simple way to design my cell with IB in nib, then load it and push two cells on each row. The example with drawRect is not appropriate because it involves manual setting of positions. I just need to push those two cells with some autosizing, that’s it. Is it possible?

I’m looking for something like (in cellForRowAtIndexPath):

cell.contentView = emptyUIViewContainer;
[cell.contentView addSubview:FirstColumnUIView];
[cell.contentView addSubview:SecondColumnUIView];

I don’t need to have two separate nibs for those two columns because every column is of the same format just with some other data. Any ideas?

UPDATE: Intuitively, I’m trying to do something like this:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

  static NSString *CellIdentifier = @"Cell";
  UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell1 == nil) {
    cell1 = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  }
  // Configure the first cell.
  cell1.textLabel.text = ...some text

  // Configure the second cell
  UITableViewCell *cell2 = [[UITableViewCell alloc] init];
  cell2.textLabel.text = ...some text

  //set row as container for two cells    
  UITableViewCell *twoColumnRowView = [[UIView alloc] init]; //initWithFrame:CGRectMake(0, 0, 200, 20)];

  cell1.contentView.frame = CGRectMake(0, 0, 100, 20);
  [twoColumnRowView addSubview:cell1];
  cell2.contentView.frame = CGRectMake(100, 0, 100, 20);
  [twoColumnRowView addSubview:cell2];

  return twoColumnRowView; // cell;
}

It’s just a raw prototype I’m playing with now. But the code crashes at runtime with “Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[UIView setTableViewStyle:]: unrecognized selector sent to instance”

UPDATE 2. I have changed a code to look more practical. Strange but after several tries I got the app working without crash but with weird black background in all cells. Here is the code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *FirstCellIdentifier = @"FirstCellIdentifier"; 
  static NSString *SecondCellIdentifier = @"SecondCellIdentifier";

  // initialize first cell
  UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:FirstCellIdentifier];

  if (cell1 == nil) {
    cell1 = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:FirstCellIdentifier] autorelease];
  }

  //initialize second cell
  UITableViewCell *cell2 = [tableView dequeueReusableCellWithIdentifier:SecondCellIdentifier];

  if (cell2 == nil) {
    cell2 = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SecondCellIdentifier] autorelease];
  }

  cell1.textLabel.text = ...data
  cell2.textLabel.text = ...data

  UITableViewCell *twoColumnRowView = [[UITableViewCell alloc] init];

  [twoColumnRowView addSubview:cell1];
  //cell2.contentView.frame = CGRectMake(100, 0, 100, 20);
  [twoColumnRowView addSubview:cell2];

  return twoColumnRowView; // cell;
}

I’m not reusing twoColumnRowView but both other does do.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:42:35+00:00Added an answer on May 25, 2026 at 1:42 pm

    You can’t (or at least, shouldn’t) put two table views next to each other. And, as you already know, a table view only ever has a single column.

    However, you can put as much data as you want in each cell.

    You can do most of this in Interface Builder. Create a XIB with a UITableViewCell. Drag and drop a couple of UILabels into the right place. You could update the labels by finding them with the viewWithTag: method, but it would be better to create a custom UITableViewCell class with properties pointing to each label.

    Since tables are so central to UIKit, there are a lot of samples in Apple’s documentation set and some good WWDC talks. You can download the videos from iTunes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to present some information in a table view where some information is
I need to present the user with a matrix of which one column is
User is a model. I have 100 users. I need to present the list
I have a PHP application using CakePHP. I need to present a table showing
I have two tables: one table (okay, it's a view), vComputer, lists many computers
I need to present a wizard once, the first time my windows forms application
I need to present a modal tab bar controller using interface builder. I'd like
I need to present a large number of rows of data (ie. millions of
For my users I need to present a screen where they can input multiple
Im designing a website, and often I need to present information in a nice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.