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

The Archive Base Latest Questions

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

I’m using a UITableView grouped to display my application preferences. I get the cell

  • 0

I’m using a UITableView grouped to display my application preferences.
I get the cell with this:

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

    NSInteger section = [indexPath section];
    NSInteger row = [indexPath row];

    NSInteger identifier = row + ((section + 1) * 10);

    NSString *CellIdentifier = [NSString stringWithFormat:@"CustomCellIdentifier-%d",identifier];

    LoginTableViewCell *cell = (LoginTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)    {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"LoginTableViewCell" owner:self options:nil];
        cell = [topLevelObjects objectAtIndex:0];

        cell.field.tag = identifier;

        if (section == 0) {

            switch (row) {
                case 0:{
                    NSString *user = [[NSUserDefaults standardUserDefaults] valueForKey:@"username"];
                    cell.field.text = user;
                    cell.label.text = @"User";
                    break;
                }
                case 1:{
                    NSString *bundleName = [[NSBundle mainBundle] bundleIdentifier];
                    NSError *error = nil;
                    NSString *user = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
                    NSString *pwd = [SFHFKeychainUtils getPasswordForUsername:user andServiceName:bundleName error:&error];
                    cell.field.text = pwd;
                    cell.field.secureTextEntry = YES;
                    cell.label.text = @"Password";
                    break;
                }
                case 2:{
                    NSString *numero = [[NSUserDefaults standardUserDefaults] valueForKey:@"numero"];
                    cell.field.text = numero;
                    cell.field.keyboardType = UIKeyboardTypePhonePad;
                    cell.label.text = @"Number";
                    break;
                }
                default:
                    break;
            }

            if (cell.field.text > 0) {
                cell.field.enabled = NO;
                cell.field.borderStyle = UITextBorderStyleNone;
            }

        } else {
            switch (row) {
                case 0:{
                    cell.field.text = [NSString stringWithFormat:@"+%@", [[NSUserDefaults standardUserDefaults] valueForKey:@"prefix"]];
                    cell.field.keyboardType = UIKeyboardTypePhonePad;
                    cell.label.text = @"Prefix";
                    break;
                }

                case 1:{
                    cell.field.text = [[NSUserDefaults standardUserDefaults] valueForKey:@"sender"];
                    cell.field.keyboardType = UIKeyboardTypeNamePhonePad;
                    cell.label.text = @"Sender";
                    break;
                }
                default:
                    break;
            }

        }

    }

    return cell;
}

The problem is that, when a row scrolls outside the window, the textfield get empty.
How can I prevent this?
I thought caching was the right solution, but even with the reusable identifier, I still have the same problem.

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

    The approach you’re using, that is loading the table cell from a nib file, requires – in order to have correct reusable cells support – to assign in the nib “Identifier” field the same string identifier you use in the code. That is, if your cell identifier used for cache deque is “MyCellId” then your UITableCellView “Identifier” field in the nib file must contain this same “MyCellId” identifier.
    But with the approach you are following this is not possible, as the cell ID is dynamically generated and then you cannot of course dynamically assign the cell identifier to the nib-loaded cell.
    In theory you must create a specific nib file for each of the MyCellId-%d identifiers you generate.
    As I assume you have only one table cell defined, get rid of the dynamic identifier generation and use a static name and then assign this name to the “Identifier” field in the cell nib file .

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i want to parse a xhtml file and display in UITableView. what is the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.