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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:24:50+00:00 2026-05-20T08:24:50+00:00

i have a grouped table, and if i write: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

  • 0

i have a grouped table, and if i write:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        if (indexPath.row == 7){ 

It doesn’t click on the 7th row…

I have this kind of UITableView (grouped):

- (void)viewDidLoad {
    NSArray *arrTemp1 = [[NSArray alloc]
                         initWithObjects:@"Scuola/Università",@"Uscita con le amiche",@"Pranzo di lavoro",@"Lavoro",@"Appuntamento",@"All'ultimo momento",nil];
    NSArray *arrTemp2 = [[NSArray alloc]
                         initWithObjects:@"Cena con amici",@"Cena di lavoro",@"Pub/Discoteca",@"Festa elegante",@"Appuntamento",@"All'ultimo momento",nil];
    NSArray *arrTemp3 = [[NSArray alloc]
                         initWithObjects:@"Compleanno",@"Anniversario",@"Matrimonio",@"Laurea/Promozione",@"San Valentino",@"Natale/Capodanno",nil];
    NSArray *arrTemp4 = [[NSArray alloc]
                         initWithObjects:@"Scelta e uso fondotinta",@"Scelta dei colori",@"I pennelli",@"Come sfumare",@"Contouring",@"Labbra perfette",nil];
    NSDictionary *temp =[[NSDictionary alloc]
                         initWithObjectsAndKeys:arrTemp1,@"Trucco da giorno",arrTemp2,
                         @"Trucco da sera",arrTemp3,@"Eventi speciali",arrTemp4,@"Lezioni di base",nil];
    self.tableContents =temp;
    [temp release];
    self.sortedKeys =[[self.tableContents allKeys]
                      sortedArrayUsingSelector:@selector(compare:)];
    [arrTemp1 release];
    [arrTemp2 release];
    [arrTemp3 release];
    [arrTemp4 release];
    [super viewDidLoad];
}

Do i need something different than ==7?

Thank you in advance

Whole code:

#import "TabellaController.h"

@implementation TabellaController
@synthesize tableContents;
@synthesize sortedKeys;



- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {  
    return UITableViewCellAccessoryDisclosureIndicator;
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    NSArray *arrTemp1 = [[NSArray alloc]
                         initWithObjects:@"Scuola/Università",@"Uscita con le amiche",@"Pranzo di lavoro",@"Lavoro",@"Appuntamento",@"All'ultimo momento",nil];
    NSArray *arrTemp2 = [[NSArray alloc]
                         initWithObjects:@"Cena con amici",@"Cena di lavoro",@"Pub/Discoteca",@"Festa elegante",@"Appuntamento",@"All'ultimo momento",nil];
    NSArray *arrTemp3 = [[NSArray alloc]
                         initWithObjects:@"Compleanno",@"Anniversario",@"Matrimonio",@"Laurea/Promozione",@"San Valentino",@"Natale/Capodanno",nil];
    NSArray *arrTemp4 = [[NSArray alloc]
                         initWithObjects:@"Scelta e uso fondotinta",@"Scelta dei colori",@"I pennelli",@"Come sfumare",@"Contouring",@"Labbra perfette",nil];
    NSDictionary *temp =[[NSDictionary alloc]
                         initWithObjectsAndKeys:arrTemp1,@"Trucco da giorno",arrTemp2,
                         @"Trucco da sera",arrTemp3,@"Eventi speciali",arrTemp4,@"Lezioni di base",nil];
    self.tableContents =temp;
    [temp release];
    self.sortedKeys =[[self.tableContents allKeys]
                      sortedArrayUsingSelector:@selector(compare:)];
    [arrTemp1 release];
    [arrTemp2 release];
    [arrTemp3 release];
    [arrTemp4 release];
    [super viewDidLoad];
}

- (void)dealloc {
    [tableContents release];
    [sortedKeys release];
    [super dealloc];
}

#pragma mark Table Methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return [self.sortedKeys count];
}

- (NSString *)tableView:(UITableView *)tableView
titleForHeaderInSection:(NSInteger)section
{
    return [self.sortedKeys objectAtIndex:section];
}

- (NSInteger)tableView:(UITableView *)table
 numberOfRowsInSection:(NSInteger)section {
    NSArray *listData =[self.tableContents objectForKey:
                        [self.sortedKeys objectAtIndex:section]];
    return [listData count];
}

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

    NSArray *listData =[self.tableContents objectForKey:
                        [self.sortedKeys objectAtIndex:[indexPath section]]];

    UITableViewCell * cell = [tableView
                              dequeueReusableCellWithIdentifier: SimpleTableIdentifier];

    if (cell == nil){ cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
                                                     reuseIdentifier:@"cellID"] autorelease];
    }

//inseriamo nella cello l'elemento della lista corrispondente
cell.textLabel.text = [listData objectAtIndex:indexPath.row]; 

return cell;
    }


    // Metodo relativo alla selezione di una cella
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        if (indexPath.row == 6){ 
            //l'utente ha cliccato sull'elemeno iPhone, quindi carichiamo la vista relativa
            detail = [[ScuolaUniversitaController alloc] initWithNibName:@"ScuolaUniversita" bundle:[NSBundle mainBundle]];
        }

        //Facciamo visualizzare la vista con i dettagli
        [self.navigationController pushViewController:detail animated:YES]; //rilasciamo il controller 
        [detail release];
        detail = nil;

}

@end
  • 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-20T08:24:50+00:00Added an answer on May 20, 2026 at 8:24 am

    if (indexPath.row == 7) does not show seventh row it shows 8th row so possible you are having only seven row and also selection type may be none.so check it correctly.

    Edit:

    ok you need to change if(indexPath.row == 7) line to

     if (indexPath.section == 1 && indexPath.row==0)
    

    actually what is going on here,you are making 3 section with 6 rows so for seventh row you can access section 1 then row 0 similerly for accesing 13th row you need to access 2nd section and row 0.

    Now i think you can understand.

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

Sidebar

Related Questions

I have a grouped table view with textfields in the tableview. For the keyboard
I have some data grouped in a table by a certain criteria, and for
I have a grouped table view and I don't want a see the background
I have a grouped table view; the table's background is a custom image. In
I currently have a UIAlertview displaying a grouped table view and have spent all
For our online game, we have written tons of PHP classes and functions grouped
I have a SqlServer2005 table Group similar to the following: Id (PK, int) Name
I have a table ALPHA with 2 fields GroupId,Member: GroupId | Member; A1----------A; A1----------B;
I have a table that I created within xcode so there is no nib
i have this: <set name=Identities table=tIdentityGroups inverse=true batch-size=10 cascade=none> <cache usage=read-write /> <key column=GroupID

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.