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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:01:17+00:00 2026-05-21T20:01:17+00:00

From coded detailView of my app which has a grouped table view. I want

  • 0

From coded detailView of my app which has a grouped table view. I want app to dial selected phone number or send text or send email if clicked on email and take to google maps if address is selected.
this is my didSelectRowAtIndexPath.. and its not working. i don’t know how to get info of selected cell. Please help.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    Directory *text = (Directory *)[tableView cellForRowAtIndexPath:indexPath];

    //check content of text.
    NSLog(@"Phone Number Selected is %@", text);

    //NSString *dialHome = [dispHomephone stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:17148581499"]]
}

And here is my cellForRowAtIndexPath if it helps.

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

    int cellPhoneLen = [dispCellphone length];
    int workPhoneLen = [dispWorkphone length];
    int homePhoneLen = [dispHomephone length];
    int emailLen = [dispEMail length];

    NSString *address = [NSString stringWithFormat:@"%@\n"@"%@ %@ %@\n"@"%@", dispAddress, dispCity, dispState, dispZip, dispCountry];
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];
    }

    cell.selectionStyle = UITableViewCellSelectionStyleBlue;

    // Configure the cell...
    switch (indexPath.section) 
    {
        case 1:
        {
            if (homePhoneLen != 0)
            {
                switch (indexPath.row)
                {
                    case 0:
                    {
                        if (homePhoneLen != 0)
                        {
                            cell.textLabel.text = NSLocalizedString(@"home :", @"homephone label");
                            cell.detailTextLabel.text = dispHomephone;
                        } break;
                    case 1:
                        if (workPhoneLen != 0)
                        {
                            cell.textLabel.text = NSLocalizedString(@"work :", @"workphone label");
                            cell.detailTextLabel.text = dispWorkphone;
                        } break;
                    case 2:
                        if (cellPhoneLen != 0)
                        {
                            cell.textLabel.text = NSLocalizedString(@"mobile :", @"cellphone label");
                            cell.detailTextLabel.text = dispCellphone;
                        }
                    }
                }
            }

            else if (workPhoneLen != 0)
            {
                switch (indexPath.row)
                {
                    case 0:
                    {
                        if (workPhoneLen != 0)
                        {
                            cell.textLabel.text = NSLocalizedString(@"work :", @"workphone label");
                            cell.detailTextLabel.text = dispWorkphone;
                        } break;
                    case 1:
                        if (cellPhoneLen != 0)
                        {
                            cell.textLabel.text = NSLocalizedString(@"mobile :", @"cellphone label");
                            cell.detailTextLabel.text = dispCellphone;
                        }
                    }
                }
            }

            else if (cellPhoneLen != 0)
                {
                    cell.textLabel.text = NSLocalizedString(@"mobile :", @"cellphone label");
                    cell.detailTextLabel.text = dispCellphone;
                }
        } break;
        case 2:
        {
            if (emailLen != 0)
            {
                cell.detailTextLabel.text = dispEMail;
            }

        } break;
        case 3:
        {           
            cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
            cell.detailTextLabel.numberOfLines = 3;
            cell.detailTextLabel.text = address;
        } break;

    }
    return cell;
}
  • 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-21T20:01:18+00:00Added an answer on May 21, 2026 at 8:01 pm
    • First off, what is Directory? Looking at your first code snippet, it looks like Directory is a subclass of UITableViewCell, but then your second snippet indicates that you are not using a UITableViewCell subclass.

      Change this line:

      Directory *text = (Directory *)[tableView cellForRowAtIndexPath:indexPath];

      To this:

      UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

      Then you can get the values of the UITableViewCell like this:

      NSString *myString = cell.detailTextLabel.text

    I’ll leave it for you to determine what type of information is stored in the cell because you know better how your app works.

    • To make a call do this:

      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",myString]]]

    • To send a text do this:

      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"sms://%@",myString]]]

    • To open maps do this:

      myString = [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
      NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", myString];
      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

    • To send an email do this:

      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto://%@",myString]]]

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

Sidebar

Related Questions

Migrating from textboxe to dropdownlist – Need to send value from a hard-coded dropdownlist
I want to call a function from a .NET DLL (coded in C#) from
When I use replace detailView segue app crashes. I'm replacing a bunch of view
I have created an app that incorporates a table view, detail view, and a
I want to create a 'detail view' in my navigation-based app similar to the
i have a main table view. and a DetailView. when cell is clicked, DetailView
My goal is to make a navigational Table View iOS app, with each cell
I have created an app which streams audio from a webserver. The music player
I have a UISplitViewController in an iPad app. When something is selected from the
As a web developer looking to move from hand-coded PHP sites to framework-based sites,

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.