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 7944973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:42:46+00:00 2026-06-04T00:42:46+00:00

I have been searching for a while trying to get help, but without luck

  • 0

I have been searching for a while trying to get help, but without luck 🙁

I want to set the subtitle in TableViewCells. The subtitles must not be the same in every cell. I have been writing some code:

- (void)viewDidLoad
{
[super viewDidLoad];
 tableData = [[NSArray alloc] initWithObjects:@"cell 1", @"cell 2", nil];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
return [tableData count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath        *)indexPath 
{
UITableViewCell *cell = nil;
cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"];
if (cell == nil)
{ 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle      reuseIdentifier:@"MyCell"];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row]; 

cell.detailTextLabel.text = @"Subtitle 1", @"Subtitle 2", nil;

return cell;
}

The problem is in cell.detailTextLabel.text = @"Subtitle 1", @"Subtitle 2", nil;

Does anybody know how to set a different subtitle in each cell?

Good luck! 🙂

  • 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-06-04T00:42:48+00:00Added an answer on June 4, 2026 at 12:42 am

    Exactly the same way you’re setting the cell titles.
    You can have another array holding the subtitles and get them like this:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        tableData = [[NSArray alloc] initWithObjects:@"cell 1", @"cell 2", nil];
        // Assuming that you have declared another property named 'tableSubtitles'
        tableSubtitles = [[NSArray alloc] initWithObjects:@"sub1", @"sub2", nil];
    }
    

    Then in your tableView:cellForRowAtIndexPath: method:

    cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
    cell.detailTextLabel.text = [tableSubtitles objectAtIndex:indexPath.row];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been searching the internet and books but have had no luck so was
I've been searching and experimenting for a while with this, but I have had
I need some help. I have been searching for days trying to find solution
I have been searching for a while for a simple right-click menu for a
I have been searching the web for an answer now for quite a while,
Have been searching how to convert a dictionary to a string. But the results
I have been searching high and low for a way to get my silverlight
I have been searching for a while on a way to select certain columns
For a little while now I've been searching for a code to get URL's
I have been searching trying to confirm my reading of the XML spec. My

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.