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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:51:31+00:00 2026-06-15T11:51:31+00:00

I have created a dynamic table, but I’m facing an issue when I try

  • 0

I have created a dynamic table, but I’m facing an issue when I try to access the content of a text field in the first cell. The textfield I get is always empty, even though I enter some text in it before calling the action.

Here is my code. Could you help me to find what’s wrong in it ?

CustomNameCell.h

@interface CustomNameCell : UITableViewCell
    @property (retain, nonatomic) IBOutlet UITextField *nameTextField;
@end

CustomViewController.h

@interface CustomViewController : UITableViewController
    @property (retain, nonatomic) IBOutlet UITableView *tableview;
    - (IBAction)search:(id)sender;
@end

CustomViewController.m :

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 1) {
        static NSString *CellIdentifier = @"nameCell";
        CustomNameCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell==nil) {
            cell = [[CustomNameCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        }
        return cell;
    }
    ...

and the action when clicking a button, where I try to get the content of the textfield :

- (IBAction)search:(id)sender {

static NSString *CellIdentifier = @"nameCell";
CustomNameCell *nameCell = [_tableview dequeueReusableCellWithIdentifier:CellIdentifier];

here nameCell.nameTextField.text is always equal to @""

Why is my text field always empty ?

Thank you for your help 😉

  • 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-15T11:51:32+00:00Added an answer on June 15, 2026 at 11:51 am

    You shouldn’t call [_tableview dequeueReusableCellWithIdentifier:CellIdentifier];within your – (IBAction)search:(id)sender as it is a mechanism to reuse a cell during the creation of your tableView. Instead of creating new cell when you are scrolling your tableview you are reusing some cells you have previously created.

    Bottom line: use instead the cellForRowAtIndexPath to access a cell at a specific row in your section and if you want the first cell of the first section it would be:

    CustomNameCell * cell = (CustomNameCell *)[tableview cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a dynamic web project in Eclipse, but when I set up
http://fiddle.jshell.net/kBFU7/2/ In the code, I have created a dynamic table through jQuery. I also
I have a DDL and Button which when clicked create a dynamic table; all
I am new in flex.I have created dynamic web project. Run it. It accessible
I am working on Moodle 2.2.1 and have created dynamic.csv files using certain queries.
I have basic hello word example of Prime Faces. I have created dynamic web
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have created a Dynamic Data site against an Entity Framework Model I have
I have created a Dynamic View Panel custom control and want to add a
I have created one dynamic button in my application and I call the following

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.