Reputation: 3
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];
Upvotes: 0
Views: 357
Reputation: 3510
you have to initialize array on viewDidLoad
self.item =[[NSMutablearray alloc]init];
Upvotes: 1