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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:00:57+00:00 2026-06-07T22:00:57+00:00

As popular sections in UITableViewCell with a single NSArray ? I have an array

  • 0

As popular sections in UITableViewCell with a single NSArray?
I have an array of events, load the data into cellForRowAtIndexPath, should I create sections by year event.

example:

section 2012
Date: 01/01/2012
Event: Live Music

Date: 01/02/2012
Event: Live Music

section 2011
Date: 01/01/2011
Event: Live Music

Date: 01/02/2011
Event: Live Music

The cells are already populated, I miss only the division into sections, the sections to create two (max two Years).

Sorry, I’m still a little confused, I can not solve, please help me, when test the year? I’ll post my code, thanks a lot

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
              //acquisisco la data dell'evento
        NSString *dataEv = [[events objectAtIndex:indexPath.row + indexPath.section]DataEvento];


//retrive year ,example 2011, 2012 when test?
NSString *Year = [Utility getPartOfDate:dataEv type:UTLGetYear];
    //set image
    ...
    [cell.contentView addSubview:myImg];

    //set day
    day.text = [Utility getPartOfDate:dataEv type:UTLGetNumberOfDay];;
    [cell.contentView addSubview:day];

    //set dayOfWeek
    ...
    dayOfWeek.text = [Utility getPartOfDate:dataEv type:UTLGetDayOfWeek];;
    [cell.contentView addSubview:dayOfWeek];

    //set month
    month.text = [Utility getPartOfDate:dataEv type:UTLGetTextMonth];;
    [cell.contentView addSubview:month];

    //set title
    ...
    lblTitleEvent.text = [[eventi objectAtIndex:indexPath.row + indexPath.section]Artist];
    [cell.contentView addSubview:lblTitoloEvento];

    //set description event
    lblDescEvento.text = [[eventi objectAtIndex:indexPath.row + indexPath.section]Description];
    [cell.contentView addSubview:lblDescriptionEvent];


      }else{

    lblTitleEvent = (UILabel*)[cell.contentView viewWithTag:5];
    lblTitleEvent.text = [[events objectAtIndex:indexPath.row + indexPath.section]Artista];

    lblDescEvent = (UILabel*)[cell.contentView viewWithTag:6];
    lblDescEvent.text = [[events objectAtIndex:indexPath.row + indexPath.section]Description];
}

return cell;

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}


    // Customize the number of rows in the table view.
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
       return [events count];        
    }

    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {        
            if(section == 0){
                return @"Section 1";
            }
            if(section == 1){
                return @"Section 2";
            }
        }
  • 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-07T22:00:58+00:00Added an answer on June 7, 2026 at 10:00 pm

    try this

    in the cell.textlabel.text:

    cell.textlabel.text = [NSString stringWithFormat:@"%@/n%@/n%@",[array1 ObjectAtIndex:row],......];
    

    also you have to set the HightForRow to a wider space

    and so on

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

Sidebar

Related Questions

Im including the popular file jquery.form.js. I have the following: var options = {
I have followed his popular tutorial to connect Android to MySQL: http://www.helloandroid.com/tutorials/connecting-mysql-database It is
I have to separate models: nested sections and articles, section has_many articles. Both have
I have two entities – PopularTutorial and Blog. This data need to be displayed
What popular programming languages were intentionally designed from the beginning to have both ===
Having looked at various popular modules for working with XML / XPath I have
I believe a popular way to declare private methods in Objective-C is to create
I have an app with two sections, Buyers and Sellers. The main section '/'
Most popular web-sites that require you to log in, have the authentication form on
Many of the most popular ones I have tried restrict the height. jCarousel for

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.