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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:14:58+00:00 2026-05-26T20:14:58+00:00

I am implementing a table index view and amazed to see how my table

  • 0

I am implementing a table index view and amazed to see how my table indexes are working even without implementing:

 - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index method.

I have only implemented:

 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView 

Strangely, when I am running in breakpoints, Once i click on any of the index values my

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

method is getting called.

Any clue why this is so happening and what is the significance of sectionForSectionIndexTitle method then.

  • 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-26T20:14:59+00:00Added an answer on May 26, 2026 at 8:14 pm

    if you have a list of all letters in alphabet and your list only contains some entries, you could use the following code:

    //Asks the data source to return the index of the section having the given title and section title index.
    – (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {

    if (tableView == self.searchDisplayController.searchResultsTableView || self.searchBar.text.length > 0)
    {
        return 0;
    }
    else
    {
    
        //direct - firsttime match
        if([self.realMIndexArray containsObject:title]) {
            NSInteger count = 0;
            for(NSString *character in self.realMIndexArray)
            {
                if([character isEqualToString:title]){
                    return count;
                }
                count ++;
            }
        }
        else {
    
            //take next higher letter from alphabet and check if its contained in the "available letters list"
            //if not, select last entry of list
            for(int i = [self.indexArray indexOfObject:title] + 1; i < [self.indexArray count]; i++) {
    
                NSString* character = [self.indexArray objectAtIndex:i];
    
                if([self.realMIndexArray containsObject:character]) {
    
                    return [self.realMIndexArray indexOfObject:character];
    
                }
    
            }
    
            return [self.realMIndexArray count] - 1;
    
        }
        return 0;// in case of some eror donot crash d application
    
    }
    

    }

    realMIndexArray count == letters really existing in list
    indexArray = list of all letters in alphbeth.

    hope this helps someone (took me a little bit of time to figure it out)

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

Sidebar

Related Questions

I'm using Indexed UITableView by implementing the following delegate methods: - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString
i was implementing the table view programmatically, where i set property of mSelectedSubUnitIndex of
I am implementing a TableViewController. I would like to create the table view with
I'm implementing a UITableView that has the index along the right hand size as
I am implementing my custom table view controller. The issue I am facing is
I'm implementing a table with a fixed header using this kind of setup: <div
I'm looking for good patterns for implementing a paged table of results in ASP.NET
I'm implementing an interface that has functionality similar to a table that can contain
I am implementing IQueryCancelAutoPlay COM interface and registering it with the Running Objects Table
I am working with a big table (~100.000.000 rows) in SQL Server 2008. Frequently,

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.