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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:32:48+00:00 2026-05-27T21:32:48+00:00

i have an indexed tableview with 8 arrays like – (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {

  • 0

i have an indexed tableview with 8 arrays like

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    NSMutableArray *tempArray = [[NSMutableArray alloc] init];
    [tempArray addObject:@"GEN"];
    [tempArray addObject:@"1SA"];
    [tempArray addObject:@"EST"];
    [tempArray addObject:@"EZE"]; 
    [tempArray addObject:@"NAH"];
    [tempArray addObject:@"JOH"];
    [tempArray addObject:@"COL"];
    [tempArray addObject:@"REV"];    
    return tempArray; 
}

and i get everything right,my problem is when i tap the cell it redirected to the another page with only first array value that is the value inside the [tempArray addObject:@"GEN"];and i tap the values in [tempArray addObject:@"1SA"];etc etc,i get the values inn the [tempArray addObject:@"GEN"];.my DidSelectRowAtIndexPath look like this

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ChapterSelectionView *detailViewController = [[ChapterSelectionView alloc] initWithNibName:@"ChapterSelectionView" bundle:nil];

    //detailViewController.firstString = firstString;
    // ...
    // Pass the selected object to the new view controller.
    detailViewController.selectedIndex=indexPath.row;
    detailViewController.selectedCountry = selectedCountry;
    appDelegate.selectedBookIndex=indexPath.row;


    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];
}

this is my complete tableview code

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

    return index % 8;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [books count];
}

my viewdidload look like this

- (void)viewDidLoad {
    [super viewDidLoad];
    l
    appDelegate=(Malayalam_BibleAppDelegate *)[[UIApplication sharedApplication] delegate];
    s";



     books = [[NSMutableArray alloc] init];

    NSArray *biblearray1 = [NSArray arrayWithObjects:@"Genesis",
                                       @"Exodus",
                                       @"Leviticus",
                                       @"Numbers",
                                       @"Deuteronomy",
                                       @"Joshua",
                                       @"Judges",
                                       @"Ruth", nil];
    NSDictionary *bibledic1 = [NSDictionary dictionaryWithObject:biblearray1 forKey:@"Countries"];

    NSArray *biblearray2 = [NSArray arrayWithObjects:@"1Samuel",
                            @"2Samuel",
                            @"1King",
                            @"2King",
                            @"1Chronicles",
                            @"2Chronicles",
                            @"Ezra",
                            @"Nehemiah", nil];
    ......etc etc


    [books addObject:bibledic1];
    [books addObject:bibledic2];
      .....etc etc
}

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSDictionary *dictionary = [books objectAtIndex:section];
    NSArray *array = [dictionary objectForKey:@"Countries"];
    return [array count];
}


// Customize the appearance of table view cells.
- (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] autorelease];

    }
    UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
    myBackView.backgroundColor = [UIColor brownColor];
   // [myBackView setBackgroundColor:[UIColor colorWithRed:1 green:1 blue:0.75 alpha:1]];
    cell.selectedBackgroundView = myBackView;
    [myBackView release];
    // Configure the cell.
   // cell.textLabel.tag =row*1+col;

    //First get the dictionary object
    NSDictionary *dictionary = [books objectAtIndex:indexPath.section];
    NSArray *array = [dictionary objectForKey:@"Countries"];
    //NSString *cellValue = [array objectAtIndex:indexPath.row];
    cell.textLabel.text =[array objectAtIndex:indexPath.row];
    cell.textLabel.highlightedTextColor = [UIColor darkGrayColor];
    //cell.textLabel.text = [books objectAtIndex:indexPath.row];
    cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];
    cell.textLabel.textColor = [UIColor darkGrayColor];
      cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;;

    return cell;
}

how to get the correct values from tableview cell.
Thanks in advance.
EDIT

- (void)viewDidLoad {
    [super viewDidLoad];
  [[self navigationController] setNavigationBarHidden:YES animated:NO];
    scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0,49,320,480)];
    appDelegate = (Malayalam_BibleAppDelegate *)[[UIApplication sharedApplication] delegate];
    //self.navigationItem.title=[appDelegate.books objectAtIndex:selectedIndex]; 
    chapterlabel.text = [appDelegate.books objectAtIndex:selectedIndex];
    buttonArray =[[NSMutableArray alloc]initWithCapacity:0];
    //self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg10"]];

        [self.view addSubview:scrollView];


}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    [[self navigationController] setNavigationBarHidden:YES animated:NO];

    n=[DbHandler mNumberOfChaptersInBook:[appDelegate.books objectAtIndex:selectedIndex]];
    int scrollViewHieght=n/6;
    scrollView.contentSize = CGSizeMake(320,10+34*scrollViewHieght);

    i=1;

    int rowCount=n/6;
    for(int row=0;row<=rowCount;row++){
        for (int col = 0; col < 6; col++) {
            if(i<=n){
                UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
                button.titleLabel.textColor=[UIColor blueColor];
                button.titleLabel.font = [UIFont fontWithName:@"Georgia" size:15.0];
                [button setBackgroundImage:[UIImage imageNamed:@"tabs"] forState:UIControlStateNormal];
                [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
                //button.frame=CGRectMake(col*52+5,row*34+50,50,32);
                button.frame=CGRectMake(col*52+5,row*34+0,50,32);
                [button addTarget:self action:@selector(ButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
                [button setTitle:[NSString stringWithFormat:@"%d",i++] forState:UIControlStateNormal];
                //button.titleLabel.font=[UIFont boldSystemFontOfSize:15];
                button.titleLabel.textColor=[UIColor blackColor];
                button.tag =row*6+col;
                [buttonArray addObject:button];
                [scrollView addSubview:[buttonArray objectAtIndex:row*6+col]];
                //[self.view addSubview:button];
                [button release];
            }
        }
    }



}
  • 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-27T21:32:49+00:00Added an answer on May 27, 2026 at 9:32 pm

    you also need to send section number to the detailViewController. Depending on the section you have to select the required array.

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

Sidebar

Related Questions

I have a tableview with an indexed scrollbar on the right side that shows
I have an indexed table view just like the contacts list in iphone. I
I have a NSArray with NSIndexPaths inside of it NSArray *array = [self.tableView indexPathsForSelectedRows];
In C# you can not have indexed properties. That said, how do I convert
I have an indexed array which I've generated from an associative array with this
My indexed documents have a field containing a pipe-delimited set of ids: a845497737704e8ab439dd410e7f1328| 0a2d7192f75148cca89b6df58fcf2e54|
I have two models indexed for searching (User and Item). I'm trying to do
I have a description field indexed in Lucene.This field contains a book's description. How
I have a domain with a loto of indexed pages, I use this one
I have a set of records indexed by id numbers, I need to convert

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.