textfield.text on tableview show value null












0















I use the codes below to add textfield to each tableview cell,



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

NSInteger row=[indexPath row];
static NSString *SimpleTableIdentifier1 = @"CellTableIdentifier";
//if I change the code to [NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; everything is fine


UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];

if (cell == nil){

CGRect cellframe=CGRectMake(0, 0, 200, 60);
cell=[[[UITableViewCell alloc] initWithFrame: cellframe reuseIdentifier:SimpleTableIdentifier1] autorelease];
UITextField * textfieldCell =[[UITextField alloc]init];
textfieldCell.frame = CGRectMake(100.0f,20.0f,60.0f,26.0f) ;
[textfieldCell setDelegate:self];
[textfieldCell setTag:40000+row];//add row value here for later use,
[cell.contentView addSubview:textfieldCell];
[textfieldCell release];

}
UITextField *textfieldCell ;

textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];
DebugLog(@"---------%@",textfieldCell.text);

return cell;


}


textfieldCell.text sometimes displays null rather than my expectation value of 'aaa1'



this means that the code line at:



textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];


sometimes returns nil, try to fix this confused result but failed



Your comment welcome










share|improve this question

























  • UITableViewCell *cell = [UITableViewCell ][textField superview] ; to get row is better solution

    – arachide
    Nov 14 '18 at 10:23
















0















I use the codes below to add textfield to each tableview cell,



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

NSInteger row=[indexPath row];
static NSString *SimpleTableIdentifier1 = @"CellTableIdentifier";
//if I change the code to [NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; everything is fine


UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];

if (cell == nil){

CGRect cellframe=CGRectMake(0, 0, 200, 60);
cell=[[[UITableViewCell alloc] initWithFrame: cellframe reuseIdentifier:SimpleTableIdentifier1] autorelease];
UITextField * textfieldCell =[[UITextField alloc]init];
textfieldCell.frame = CGRectMake(100.0f,20.0f,60.0f,26.0f) ;
[textfieldCell setDelegate:self];
[textfieldCell setTag:40000+row];//add row value here for later use,
[cell.contentView addSubview:textfieldCell];
[textfieldCell release];

}
UITextField *textfieldCell ;

textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];
DebugLog(@"---------%@",textfieldCell.text);

return cell;


}


textfieldCell.text sometimes displays null rather than my expectation value of 'aaa1'



this means that the code line at:



textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];


sometimes returns nil, try to fix this confused result but failed



Your comment welcome










share|improve this question

























  • UITableViewCell *cell = [UITableViewCell ][textField superview] ; to get row is better solution

    – arachide
    Nov 14 '18 at 10:23














0












0








0








I use the codes below to add textfield to each tableview cell,



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

NSInteger row=[indexPath row];
static NSString *SimpleTableIdentifier1 = @"CellTableIdentifier";
//if I change the code to [NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; everything is fine


UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];

if (cell == nil){

CGRect cellframe=CGRectMake(0, 0, 200, 60);
cell=[[[UITableViewCell alloc] initWithFrame: cellframe reuseIdentifier:SimpleTableIdentifier1] autorelease];
UITextField * textfieldCell =[[UITextField alloc]init];
textfieldCell.frame = CGRectMake(100.0f,20.0f,60.0f,26.0f) ;
[textfieldCell setDelegate:self];
[textfieldCell setTag:40000+row];//add row value here for later use,
[cell.contentView addSubview:textfieldCell];
[textfieldCell release];

}
UITextField *textfieldCell ;

textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];
DebugLog(@"---------%@",textfieldCell.text);

return cell;


}


textfieldCell.text sometimes displays null rather than my expectation value of 'aaa1'



this means that the code line at:



textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];


sometimes returns nil, try to fix this confused result but failed



Your comment welcome










share|improve this question
















I use the codes below to add textfield to each tableview cell,



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

NSInteger row=[indexPath row];
static NSString *SimpleTableIdentifier1 = @"CellTableIdentifier";
//if I change the code to [NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; everything is fine


UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];

if (cell == nil){

CGRect cellframe=CGRectMake(0, 0, 200, 60);
cell=[[[UITableViewCell alloc] initWithFrame: cellframe reuseIdentifier:SimpleTableIdentifier1] autorelease];
UITextField * textfieldCell =[[UITextField alloc]init];
textfieldCell.frame = CGRectMake(100.0f,20.0f,60.0f,26.0f) ;
[textfieldCell setDelegate:self];
[textfieldCell setTag:40000+row];//add row value here for later use,
[cell.contentView addSubview:textfieldCell];
[textfieldCell release];

}
UITextField *textfieldCell ;

textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];
DebugLog(@"---------%@",textfieldCell.text);

return cell;


}


textfieldCell.text sometimes displays null rather than my expectation value of 'aaa1'



this means that the code line at:



textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];


sometimes returns nil, try to fix this confused result but failed



Your comment welcome







ios






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 0:57







arachide

















asked Nov 14 '18 at 0:05









arachidearachide

3,7511658118




3,7511658118













  • UITableViewCell *cell = [UITableViewCell ][textField superview] ; to get row is better solution

    – arachide
    Nov 14 '18 at 10:23



















  • UITableViewCell *cell = [UITableViewCell ][textField superview] ; to get row is better solution

    – arachide
    Nov 14 '18 at 10:23

















UITableViewCell *cell = [UITableViewCell ][textField superview] ; to get row is better solution

– arachide
Nov 14 '18 at 10:23





UITableViewCell *cell = [UITableViewCell ][textField superview] ; to get row is better solution

– arachide
Nov 14 '18 at 10:23












2 Answers
2






active

oldest

votes


















0














UITableView uses a dynamic pool of cells for performance reasons. The only cells which are actually active are those which are currently displayed on the screen. Any cells which are scrolled out of view are removed from the view and returned to a pool identified by, in your case, "SimpleTableIdentifier1"



The method dequeueReusableCell retrieves a cell from the pool, if one is available, or creates one if a class or XIB has been registered, otherwise returns nil.



The upshot of this is that your code may return a previously created cell which has been used for some other row earlier. The tag which exists for that cell will most likely relate to some other row. This will all depend on the scrolling of rows on and off screen.



Changing the identifier to "CellTableIdentifier"%row causes each cell to be allocated from its own pool and avoids this conflict. However that will completely defeat the purpose of reusing cells.



Since you are using tag just to locate the text field within the cell you do not need to make the tag unique across all cells of the table. Just use a simple constant ie. 4000 not 4000 + row. viewWithTag will return the view within the hierarchy which matches, and you are starting at the content view anyway.



Having said all that, the structure of your code is really not ideal. The better approach is to define your cell as a class, the layout in the storyboard, and access the text field directly as a member of the class.






share|improve this answer

































    1














    This dequeueReusableCellWithIdentifier



     UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];


    returns a non nil cell Docs




    This method dequeues an existing cell if one is available or creates a new one using the class or nib file you previously registered. If no cell is available for reuse and you did not register a class or nib file, this method returns nil




    that may has a textField with different tag resulting in nil for



     UITextField *textfieldCell ;


    as these 2 lines



    // here rhs may be nil
    textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
    textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];


    has no effect with nil textfield , also it's shocking how you still work with MRC ( Manual reference counting ) here



    [textfieldCell release];


    please update to ARC ( Automatic reference counting ) which will removes your worries about memory management issues






    share|improve this answer


























    • Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

      – arachide
      Nov 14 '18 at 0:36













    • ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

      – Sh_Khan
      Nov 14 '18 at 0:39













    • [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

      – arachide
      Nov 14 '18 at 0:42











    • @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

      – Sh_Khan
      Nov 14 '18 at 0:46











    • I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

      – arachide
      Nov 14 '18 at 0:52











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291267%2ftextfield-text-on-tableview-show-value-null%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    UITableView uses a dynamic pool of cells for performance reasons. The only cells which are actually active are those which are currently displayed on the screen. Any cells which are scrolled out of view are removed from the view and returned to a pool identified by, in your case, "SimpleTableIdentifier1"



    The method dequeueReusableCell retrieves a cell from the pool, if one is available, or creates one if a class or XIB has been registered, otherwise returns nil.



    The upshot of this is that your code may return a previously created cell which has been used for some other row earlier. The tag which exists for that cell will most likely relate to some other row. This will all depend on the scrolling of rows on and off screen.



    Changing the identifier to "CellTableIdentifier"%row causes each cell to be allocated from its own pool and avoids this conflict. However that will completely defeat the purpose of reusing cells.



    Since you are using tag just to locate the text field within the cell you do not need to make the tag unique across all cells of the table. Just use a simple constant ie. 4000 not 4000 + row. viewWithTag will return the view within the hierarchy which matches, and you are starting at the content view anyway.



    Having said all that, the structure of your code is really not ideal. The better approach is to define your cell as a class, the layout in the storyboard, and access the text field directly as a member of the class.






    share|improve this answer






























      0














      UITableView uses a dynamic pool of cells for performance reasons. The only cells which are actually active are those which are currently displayed on the screen. Any cells which are scrolled out of view are removed from the view and returned to a pool identified by, in your case, "SimpleTableIdentifier1"



      The method dequeueReusableCell retrieves a cell from the pool, if one is available, or creates one if a class or XIB has been registered, otherwise returns nil.



      The upshot of this is that your code may return a previously created cell which has been used for some other row earlier. The tag which exists for that cell will most likely relate to some other row. This will all depend on the scrolling of rows on and off screen.



      Changing the identifier to "CellTableIdentifier"%row causes each cell to be allocated from its own pool and avoids this conflict. However that will completely defeat the purpose of reusing cells.



      Since you are using tag just to locate the text field within the cell you do not need to make the tag unique across all cells of the table. Just use a simple constant ie. 4000 not 4000 + row. viewWithTag will return the view within the hierarchy which matches, and you are starting at the content view anyway.



      Having said all that, the structure of your code is really not ideal. The better approach is to define your cell as a class, the layout in the storyboard, and access the text field directly as a member of the class.






      share|improve this answer




























        0












        0








        0







        UITableView uses a dynamic pool of cells for performance reasons. The only cells which are actually active are those which are currently displayed on the screen. Any cells which are scrolled out of view are removed from the view and returned to a pool identified by, in your case, "SimpleTableIdentifier1"



        The method dequeueReusableCell retrieves a cell from the pool, if one is available, or creates one if a class or XIB has been registered, otherwise returns nil.



        The upshot of this is that your code may return a previously created cell which has been used for some other row earlier. The tag which exists for that cell will most likely relate to some other row. This will all depend on the scrolling of rows on and off screen.



        Changing the identifier to "CellTableIdentifier"%row causes each cell to be allocated from its own pool and avoids this conflict. However that will completely defeat the purpose of reusing cells.



        Since you are using tag just to locate the text field within the cell you do not need to make the tag unique across all cells of the table. Just use a simple constant ie. 4000 not 4000 + row. viewWithTag will return the view within the hierarchy which matches, and you are starting at the content view anyway.



        Having said all that, the structure of your code is really not ideal. The better approach is to define your cell as a class, the layout in the storyboard, and access the text field directly as a member of the class.






        share|improve this answer















        UITableView uses a dynamic pool of cells for performance reasons. The only cells which are actually active are those which are currently displayed on the screen. Any cells which are scrolled out of view are removed from the view and returned to a pool identified by, in your case, "SimpleTableIdentifier1"



        The method dequeueReusableCell retrieves a cell from the pool, if one is available, or creates one if a class or XIB has been registered, otherwise returns nil.



        The upshot of this is that your code may return a previously created cell which has been used for some other row earlier. The tag which exists for that cell will most likely relate to some other row. This will all depend on the scrolling of rows on and off screen.



        Changing the identifier to "CellTableIdentifier"%row causes each cell to be allocated from its own pool and avoids this conflict. However that will completely defeat the purpose of reusing cells.



        Since you are using tag just to locate the text field within the cell you do not need to make the tag unique across all cells of the table. Just use a simple constant ie. 4000 not 4000 + row. viewWithTag will return the view within the hierarchy which matches, and you are starting at the content view anyway.



        Having said all that, the structure of your code is really not ideal. The better approach is to define your cell as a class, the layout in the storyboard, and access the text field directly as a member of the class.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 '18 at 3:12

























        answered Nov 14 '18 at 2:20









        DaleDale

        1,6681219




        1,6681219

























            1














            This dequeueReusableCellWithIdentifier



             UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];


            returns a non nil cell Docs




            This method dequeues an existing cell if one is available or creates a new one using the class or nib file you previously registered. If no cell is available for reuse and you did not register a class or nib file, this method returns nil




            that may has a textField with different tag resulting in nil for



             UITextField *textfieldCell ;


            as these 2 lines



            // here rhs may be nil
            textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
            textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];


            has no effect with nil textfield , also it's shocking how you still work with MRC ( Manual reference counting ) here



            [textfieldCell release];


            please update to ARC ( Automatic reference counting ) which will removes your worries about memory management issues






            share|improve this answer


























            • Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

              – arachide
              Nov 14 '18 at 0:36













            • ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

              – Sh_Khan
              Nov 14 '18 at 0:39













            • [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

              – arachide
              Nov 14 '18 at 0:42











            • @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

              – Sh_Khan
              Nov 14 '18 at 0:46











            • I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

              – arachide
              Nov 14 '18 at 0:52
















            1














            This dequeueReusableCellWithIdentifier



             UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];


            returns a non nil cell Docs




            This method dequeues an existing cell if one is available or creates a new one using the class or nib file you previously registered. If no cell is available for reuse and you did not register a class or nib file, this method returns nil




            that may has a textField with different tag resulting in nil for



             UITextField *textfieldCell ;


            as these 2 lines



            // here rhs may be nil
            textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
            textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];


            has no effect with nil textfield , also it's shocking how you still work with MRC ( Manual reference counting ) here



            [textfieldCell release];


            please update to ARC ( Automatic reference counting ) which will removes your worries about memory management issues






            share|improve this answer


























            • Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

              – arachide
              Nov 14 '18 at 0:36













            • ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

              – Sh_Khan
              Nov 14 '18 at 0:39













            • [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

              – arachide
              Nov 14 '18 at 0:42











            • @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

              – Sh_Khan
              Nov 14 '18 at 0:46











            • I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

              – arachide
              Nov 14 '18 at 0:52














            1












            1








            1







            This dequeueReusableCellWithIdentifier



             UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];


            returns a non nil cell Docs




            This method dequeues an existing cell if one is available or creates a new one using the class or nib file you previously registered. If no cell is available for reuse and you did not register a class or nib file, this method returns nil




            that may has a textField with different tag resulting in nil for



             UITextField *textfieldCell ;


            as these 2 lines



            // here rhs may be nil
            textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
            textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];


            has no effect with nil textfield , also it's shocking how you still work with MRC ( Manual reference counting ) here



            [textfieldCell release];


            please update to ARC ( Automatic reference counting ) which will removes your worries about memory management issues






            share|improve this answer















            This dequeueReusableCellWithIdentifier



             UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ];


            returns a non nil cell Docs




            This method dequeues an existing cell if one is available or creates a new one using the class or nib file you previously registered. If no cell is available for reuse and you did not register a class or nib file, this method returns nil




            that may has a textField with different tag resulting in nil for



             UITextField *textfieldCell ;


            as these 2 lines



            // here rhs may be nil
            textfieldCell =(UITextField*)[cell.contentView viewWithTag:40000+row];
            textfieldCell.text=[ NSMutableString stringWithString:@"aaa1"];


            has no effect with nil textfield , also it's shocking how you still work with MRC ( Manual reference counting ) here



            [textfieldCell release];


            please update to ARC ( Automatic reference counting ) which will removes your worries about memory management issues







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 14 '18 at 0:43

























            answered Nov 14 '18 at 0:14









            Sh_KhanSh_Khan

            40.8k51125




            40.8k51125













            • Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

              – arachide
              Nov 14 '18 at 0:36













            • ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

              – Sh_Khan
              Nov 14 '18 at 0:39













            • [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

              – arachide
              Nov 14 '18 at 0:42











            • @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

              – Sh_Khan
              Nov 14 '18 at 0:46











            • I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

              – arachide
              Nov 14 '18 at 0:52



















            • Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

              – arachide
              Nov 14 '18 at 0:36













            • ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

              – Sh_Khan
              Nov 14 '18 at 0:39













            • [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

              – arachide
              Nov 14 '18 at 0:42











            • @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

              – Sh_Khan
              Nov 14 '18 at 0:46











            • I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

              – arachide
              Nov 14 '18 at 0:52

















            Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

            – arachide
            Nov 14 '18 at 0:36







            Thanks your quick reply, but it looks you describe the question again rather a solution, ARC is not the problem

            – arachide
            Nov 14 '18 at 0:36















            ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

            – Sh_Khan
            Nov 14 '18 at 0:39







            ARC is a tip for you it has no relation to the problem , as i told above deqeuing line may return a texfiled with different tag as you embed row in 4000 + row , note that table cells are dequeued

            – Sh_Khan
            Nov 14 '18 at 0:39















            [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

            – arachide
            Nov 14 '18 at 0:42





            [textfieldCell setTag:40000+row]; is for later tap the textfield notification, different tag means different textfield

            – arachide
            Nov 14 '18 at 0:42













            @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

            – Sh_Khan
            Nov 14 '18 at 0:46





            @arachide if cell == nil will never hit remove it and first clear the cell from old textfeild if exists and add the new one , also i recommend a prototype cell/xib instead of adding elements in cellfoRow and link them as outlets and set your tag

            – Sh_Khan
            Nov 14 '18 at 0:46













            I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

            – arachide
            Nov 14 '18 at 0:52





            I change code to NSString *SimpleTableIdentifier1 =NSString stringWithFormat:@"CellTableIdentifier%d",row]; it looks like everything is fine, but wonder if there is any later conflict

            – arachide
            Nov 14 '18 at 0:52


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291267%2ftextfield-text-on-tableview-show-value-null%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Hercules Kyvelos

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud