0

I'm a beginner to XCode.

1- I have a view with UITableViewCell(FirstViewController)
2- I have another view(SecondViewController) that contains some textfields to get data from user
3- I have to pass this data to the FirstViewController
4- The data is passed successfully to the FirstViewController and successfully added in the TableViewCell
5- but the problem is that....
6- if I add another data, it is added but the previous cell get blanked. How can I preserve the previous data while saving new one????????

7- temp is variable where data is collected... 8-here (item) is NSMutablearray.. It adds object(temp) to item using

             [self.item addObject:temp ]; 

.. but old value of temp get lost ;(

///my Code

     data *temp;
    temp =[[data alloc]init];

    temp.name=NSLocalizedString(textofsub, @"name");
    temp.detail=NSLocalizedString(@"Teacher", @"detail");
    temp.image=@"a.jpg";
    temp.time=NSLocalizedString(@"8:30", @"time");

    [self.item addObject:temp ];    //
    [self.mytableView reloadData];

1 Answer 1

1

you have to initialize array on viewDidLoad

   self.item =[[NSMutablearray alloc]init];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.