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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:28:39+00:00 2026-06-16T09:28:39+00:00

In my Application i have Two Tableviews one is my main Tableview and Second

  • 0

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
enter image description here

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.

  • 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-06-16T09:28:41+00:00Added an answer on June 16, 2026 at 9:28 am

    Store array in userDefault instead of string like bellow..

    In AppDelegate.h file just declare variable…

    NSUserDefaults  *userDefaults;
    NSMutableArray *yourArray;
    after...
    

    In AppDelegate.m Fille in applicationDidFinishLonching: Method

    userDefaults = [NSUserDefaults standardUserDefaults];
    NSData *dataRepresentingtblArrayForSearch = [userDefaults objectForKey:@"yourArray"];
    if (dataRepresentingtblArrayForSearch != nil) {
        NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingtblArrayForSearch];
        if (oldSavedArray != nil)
            yourArray = [[NSMutableArray alloc] initWithArray:oldSavedArray];
        else
            yourArray = [[NSMutableArray alloc] init];
    } else {
        yourArray = [[NSMutableArray alloc] init];
    }
    [yourArray retain];
    

    after when you want to insert Data in this UserDefaults Use Bellow Code…

    [appDelegate.yourArray addObject:yourDataString];///set your value or anything which you want to store here...
    NSData *data=[NSKeyedArchiver archivedDataWithRootObject:appDelegate.yourArray];
    [appDelegate.userDefaults setObject:data forKey:@"yourArray"];
    [appDelegate.userDefaults synchronize];
    

    when you want to create AppDelegate object then use bellow code..

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    

    i hope this help you…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application where i have two view controllers my first view and second
In my application i have two drop down boxes first box had origin second
I have a simple application with two views, one is a TableView and the
In Application i have two buttons in which one button is used as a
I have an application that uses Core Data. I have two data models in
I trying to display image in picture box. The application have two part. First
In this moment, I have two web applications(one application is an MVC2 application for
I have a core data iPhone application. I have two views on a navigation
I have two Tabitems, In first TabItems i have One NavigationViewController. Now When i
I have two rails applications. In the first application i have the following method

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.