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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:07:03+00:00 2026-06-13T06:07:03+00:00

So I am using a uitableview to display multiple images and labels. I want

  • 0

So I am using a uitableview to display multiple images and labels. I want to be able to check the text of the label of the cell that is clicked so that I can identify which one is clicked.

The reason I do this is because I want to do a different action for one cell being clicked, and a different action for another.

This is how I populate my cells (from a prototype cell) With the cell defenition from a class called CustomCell

//tableview datasource delegate methods
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return cellIconNames.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath{

static NSString *CellIdentifier = @"Cell";

cellIconName = [cellIconNames objectAtIndex:indexPath.row];


NSString *cellIconImageName = [[self cellIconImages] objectAtIndex:[indexPath row]];

CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];


if(cell == nil){
    cell = [[CustomCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.rightLabel.text = [cellIconNames objectAtIndex:indexPath.row];
cell.carrierImage.image = [UIImage imageNamed:cellIconImageName];
cell.urlString = [cellIconNames objectAtIndex:indexPath.row];

return cell;
}

The way I am checking to see which one is clicked is by doing this:

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

CustomCell *cell = (CustomCell*)[tableView cellForRowAtIndexPath:indexPath];
//[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google.com"]];

if ([cell.urlString isEqualToString:@"Aetna"]) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.aetna.com"]];
}else if([cell.urlString isEqualToString:nil]){
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google.com"]];
}
NSLog(@"cell was clicked %@", cell);
}

When i click a cell, nothing happens. Now i have made that NSLOG so that i can make sure the cells are being read correctly which they are.

I also have commented out my testing line of code, I had the if else statment commented out and just ran the one commented line of code, and nothing happens.

Please help me, i have no idea what is going wrong :/

  • 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-13T06:07:05+00:00Added an answer on June 13, 2026 at 6:07 am

    Try putting the URL method into the string (e.g. http://).

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

Sidebar

Related Questions

I'm creating a grid of thumbnail images, using a UITableView where each cell display
I am using a UITableView that points to a UITabBarController to display a series
I'm using a UITableView grouped to display my application preferences. I get the cell
I am using a UITableView to display some data which the user can filter.
I'm working on proof of concept project. That is using a UITableView to display
Deployed project using UITableView for display of images. Upgraded to xCode 4.5, suddenly my
I'm using a UITableView to display custom cells created with Interface Builder. The table
I have a UITextView which I am using to display text. Along the side
I am using a UITableView to display the results of a series of calculations.
In an iPhone/iPad app, I'm using a UITableView to display a list of items

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.