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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:53:07+00:00 2026-06-02T15:53:07+00:00

Im saving data and reloading using the follwing code. – (IBAction)savefirstline:(id)sender { NSString *savecontents

  • 0

Im saving data and reloading using the follwing code.

- (IBAction)savefirstline:(id)sender {
NSString *savecontents = firstlineofadsress.text; 
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:savecontents forKey:@"savecontents2"];
[defaults synchronize];



- (IBAction)loadfirstline:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *loadstring = [defaults objectForKey:@"savecontents2"];
[firstlineofadsress setText:loadstring];

My question is how do i add more text fields to this method. Presently I have to set up each text box with two buttons to enable save and load of the string and im sure this cant be right as i have about 5 text fields. Ive tried adding other textfields.text to the NSSstring but just keep getting errors

  • 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-02T15:53:10+00:00Added an answer on June 2, 2026 at 3:53 pm

    You could give each of your textfields a unqie tag number, and then create a switch that deals with each textfield.

    so something like:

     switch ([sender tag]) {
        case 1:
        [defaults setObject:savecontents forKey:@"savecontents2"];
        [defaults synchronize];
        case 2:
        //...
        case 3:
        //...
        case 4:
        case 5:
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using C# with .net 3.5 I am saving my program data in
I am working on a project in which I am saving data in a
So, there have been several posts here about importing and saving data from an
I'm saving my data with Array, look: Get data: $data['address'] = $this->input->post('address'); Save: $this->load->model('mymodel');
I have a action class for saving some data to a database.In action class
I have ListView which is saving all data to database. For adding i have
I have created a web service which is saving some data into to db.
I've just realized that when I use write.table() for saving a data frame in
I'm looking to enable saving of form data prior to submission. I want users
I want to do encode the data before saving it to a database table

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.