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

  • Home
  • SEARCH
  • 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 8077655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:32:15+00:00 2026-06-05T15:32:15+00:00

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell2; UILabel *titleLabel;

  • 0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell2";
    UILabel *titleLabel;
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 300, 20)];
        [cell.contentView addSubview:titleLabel];
        titleLabel.tag = 0011;
    }
    else 
    {
        titleLabel = (UILabel *)[cell.contentView viewWithTag:0011];
    }

    // Configure the cell...
    NSMutableString *title = [NSMutableString stringWithString:@"Customer: "];
    [title appendString:[titles objectAtIndex:indexPath.row]];
    titleLabel.text = title.copy;
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textAlignment = UITextAlignmentLeft;
    titleLabel.font = [UIFont systemFontOfSize:18.0];

My cell is never nil, and my titleLabel, because of that never got allocated, although my cells are generated. I can not see how this is possible. The if state is never true, which should be for the cells that are being generated for the first time, but my cells are created as they should be, without my titleLabel’s

  • 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-05T15:32:17+00:00Added an answer on June 5, 2026 at 3:32 pm

    It sounds as if you are using iOS 5 (or later) and Storyboards.

    Under iOS 5 (or later), if you are using Storyboards and the TableView Controller, the dequeueReusableCellWithIdentifier: method is guaranteed to return a cell (provided that you have defined a cell with the given identifier in the Storyboard).

    If this is the case, the solution is to fully create the custom table cell in the Storyboard. Go to your Table View in your Storyboard, select Content:Dynamic Prototypes and make the Prototype Cells:1. Now layout your cell graphically to be exactly what you want. Now click on the cell and set Identifier:Cell2. You will now not need to create the label at runtime or check if it is nil. Full details including how to reference the labels you have setup are in the iOS 5 Release Notes (link below) or in many tutorials on the web.

    See the iOS 5 Release Notes section Configuring Table Views

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

Sidebar

Related Questions

My NSXMLParser breaks on this string: <title>AAA &#8211; BCDEFGQWERTYUIO</title> I parsed it in this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I would like to count the length of a string with PHP. The string
I've got the following login script.. <?php $name = $_POST[name]; $password = $_POST[password]; $query
So to start, I have an array of XML files. These files need to
I'm struggling to position the second level of a dropdown nav menu and was
Have a webpage that will be viewed by mainly IE users, so CSS3 is
I'm trying to craft a Java regular expression to split strings of the general
Welcome to Spring Roo. For assistance press CTRL+SPACE or type hint then hit ENTER.
I am reading some og tags from sites but I can't seem to decode

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.