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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:51:31+00:00 2026-05-26T16:51:31+00:00

I have a tableview which contains some text and I have a label inside

  • 0

I have a tableview which contains some text and I have a label inside tableviewcell as subview, in the label there is also some values. My question is, when I tap the cell I want to get the label value, I know how to get a cell value when tapping the cell but I need to get the label value, my code for getting the tablecell value is

NSString *localStringValue;
localStringValue = [tableView cellForRowAtIndexPath:indexPath].textLabel.text; 

and I display it in a textview textview.text = self.localStringValue;
My label name is chapterandverse, I need to implement this label instead of textlabel.text.
I add localStringValue = [tableView cellForRowAtIndexPath:indexPath].chapterandverse.text;
but I got error for this code. Please help me to do this.
Thanks in advance.

  • 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-26T16:51:32+00:00Added an answer on May 26, 2026 at 4:51 pm

    There’s 2 main ways to do this:

    1. You can give the chapterandverse label a tag value. In Interface Builder, there is a Tag property on the same page where you set the other properties like Text. If you’re doing it programmatically, chapterandverse.tag = 1;. Then you need to refer to the label by the tag value, like:

      localStringValue = [(UILabel *)[[tableView cellForRowAtIndexPath:indexPath]
                                      viewWithTag:1] text];
      
    2. You can do it by having an @property referring to the label in your custom table view cell class. You seem to have already tried to do this, but note that if you call [cell addSubview:chapterandverse] that does not mean you can later say cell.chapterandverse. To make it work properly, you need to make a subclass of UITableViewCell and add the following declaration to it:

      @property (nonatomic, retain) IBOutlet UILabel *chapterandverse;
      

      And then synthesize it in the cell’s .m file:

      @synthesize chapterandverse;
      

      Then you can connect the label you placed in Interface Builder to the chapterandverse outlet on the view and refer to it by cell.chapterandverse like you are doing. If you create it programmatically, though, you will need to initialise the UILabel before using it:

      - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
      {
          self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
          if(self != nil)
          {
              CGRect labelFrame = CGRectMake(x, y, width, height); // set this properly
              self.chapterandverse = [[UILabel alloc] initWithFrame:frame];
              [self.view addSubview:self.chapterandverse];
          }
      
          return self;
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tableview which contains custom cells where each cell has some PDF
I have an app which contains a scrollview with several tableviews. Each tableview is
I have a view which contains a tableview, (i call this view the EquationView,
I have a tableView which lists the contents of the document directory. It contains
I have a tableview which contains images in cell. If I touch an image
I have a tableView which has cells with phone numbers. The app is not
I have a view which I built in Interface builder with a tableview and
When I have a table view with some sections which have their own headers
I have a navigation controller which also has a table view. I want to
I have a tableView with multiple sections. When a sections contains only one row,

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.