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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:34:59+00:00 2026-05-23T00:34:59+00:00

hii every one i have created a data entry screen like this in which

  • 0

hii every one

i have created a data entry screen like this in which each row contains a text field
enter image description here

here after entering data into the text field if we scroll the page which are all the text fields goesup(beyond the view) will set to null when it come back to the original position,, this is my code for each cell where CustomCellStudentData is a cell class where i have created frames for lables

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //static NSString *CellIdentifier = @"Cell";

    CustomCellStudentData *cell = (CustomCellStudentData*)[tableView dequeueReusableCellWithIdentifier:nil];

    if (cell == nil) {
      cell = [[[CustomCellStudentData alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];
    }
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];

    switch(indexPath.section)
    { 
        case 0:
            switch (indexPath.row) 
            {
                case 0:
                {
                    tfText[0] = [[UITextField alloc] initWithFrame:CGRectMake(125,22, 170, 25)];
                    cell.accessoryView = tfText[0];
                    tfText[0].delegate=self;
                    tfText[0].font = [UIFont systemFontOfSize:14];
                    tfText[0].placeholder =@"<Student Name>";

                    cell.primaryLabel.text =@"Student Name: ";

                } 
                break;

                case 1: 
                {
                    tfText[1] = [[UITextField alloc] initWithFrame:CGRectMake(125,22, 170, 25)];
                    cell.accessoryView = tfText[1];
                    tfText[1].delegate=self;
                    tfText[1].font = [UIFont systemFontOfSize:14];
                    tfText[1].placeholder =@"<Student Age>";
                    tfText[1].keyboardType = UIKeyboardTypeNumbersAndPunctuation;
                   cell.primaryLabel.text =@"Student Age: ";
                } 
                break;

                case 2:
                {
                    cell.primaryLabel.text =@"Gender: ";

                    segmentedControl = [[UISegmentedControl alloc] initWithItems:nil];
                    segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
                    segmentedControl.frame = CGRectMake(125,22, 170, 25);
                    [segmentedControl insertSegmentWithTitle:@"Male" atIndex:0 animated:YES];
                    [segmentedControl insertSegmentWithTitle:@"Female" atIndex:1 animated:YES];
                    segmentedControl.selectedSegmentIndex = 1;
                    [segmentedControl setMomentary:NO];
                    [segmentedControl addTarget:self action:@selector(segmentSwitch:) forControlEvents:UIControlEventValueChanged];
                    cell.accessoryView =segmentedControl;
                }
                break;

                case 3:
                {
                    tfText[3] = [[UITextField alloc] initWithFrame:CGRectMake(125,22, 170, 25)];
                    cell.accessoryView = tfText[3];
                    tfText[3].delegate=self;
                    tfText[3].font = [UIFont systemFontOfSize:14];
                    tfText[3].placeholder =@"<dd/mm/yyyy>";
                    tfText[3].keyboardType = UIKeyboardTypeNumbersAndPunctuation;
                    cell.primaryLabel.text =@"Date Of Birth: ";
                }
    }
}

y that data becoming null, how can i resolve this ,, can any one help me,,
thanx 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-23T00:34:59+00:00Added an answer on May 23, 2026 at 12:34 am

    You are creating the text fields every time cellForRowAtIndexPath: is called. I think you can solve this problem by creating the text fields elsewhere, probably in viewDidLoad or similar method and just set the accessory view when the cellForRowAtIndexPath: is called. For example,

    tfText[0] = [[UITextField alloc] initWithFrame:CGRectMake(125,22, 170, 25)];
    tfText[0].delegate=self;
    tfText[0].font = [UIFont systemFontOfSize:14];
    tfText[0].placeholder =@"<Student Name>";
    

    Move the top four lines to viewDidLoad and create them only once. And let the line below remain as it is.

    cell.accessoryView = tfText[0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hii every one i am brand new to obj c, i have did a
hii every one i am using following code to loading data stored in data
Hi I want to have two tables each have an INT id column which
Hi I have a colorbox which opens on every page when the user clicks
hi I have a scenario like this I made a chat program where a
hii every one can i use a navigation based template to create project in
hii every one I need to add one column to my existing table so
Hi I have an ajax script which validates the users information put into textboxes.
Hi I have a form with a text area for comments. The problem is
Hi this question or problem i have its very hard i have search 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.