In my Application i have Two Tableviews one is my main Tableview and Second one is my Favourit tableview.First of all i show all my plist data in mainView when i Click on any Row of my MainTableview it goes to Next Class as my Screen shot Show below

Now in this View i have a UILabel which show my Text selected from main Tableview and most importantly i have UIButton Add to Favorit. i want that when i click on it save the Current UIlabel Value and when i goes to favourit tableview then i want to show this value there.i try to save value using NSUserdefualt but it not works for me Beacuse it save the last value not keep the record of pervious one values.here is my code which i tried so for..
-(IBAction)AddToF
{
NSString *str=lblText.text;
[[NSUserDefaults standardUserDefaults] setObject:str forKey:@"preferenceName"];
}
And then in Favurit tableview i get these value
- (void)viewWillAppear:(BOOL)animated
{
NSString *savedValue = [[NSUserDefaults standardUserDefaults]
stringForKey:@"preferenceName"];
[super viewWillAppear:animated];
}
Can some guide me how to fix it.Thanks.
Store array in userDefault instead of string like bellow..
In
AppDelegate.hfile just declare variable…In
AppDelegate.mFille inapplicationDidFinishLonching:Methodafter when you want to insert Data in this UserDefaults Use Bellow Code…
when you want to create
AppDelegateobject then use bellow code..i hope this help you…