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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:49:05+00:00 2026-05-27T10:49:05+00:00

i have a tableview with a list of categories. if the user taps on

  • 0

i have a tableview with a list of categories. if the user taps on add button an alertview with a textfield and ‘ok’ button appears.and the text entered in the textfield should be added to the table view.I am able to add it but its not getting added to the plist.so if we move to another view and come back that just vanishes.how to make it stay like that.

-(void)viewDidLoad 
{
     NSString *fileForCategoryList = [[NSBundle mainBundle] pathForResource:kCATEGORY_LIST ofType:kP_List];
     self.arrayForCategories = [[NSMutableArray alloc]initWithContentsOfFile:fileForCategoryList];
}

- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
        [self.arrayForCategories removeObjectAtIndex:indexPath.row];
        [self.tableViewC reloadData];
    } 
    else if (editingStyle == UITableViewCellEditingStyleInsert)
    {
        UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:kYOUR_TITLE message:kEMPTY delegate:self cancelButtonTitle:kCANCEL otherButtonTitles:kOK, nil];
        self.myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
        [self.myTextField setBackgroundColor:[UIColor whiteColor]];
        [myAlertView addSubview:self.myTextField];
        [myAlertView show];
        [myAlertView release];  
    }
}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 
{
    if ([self.myTextField text])
    {
        [self.arrayForCategories addObject:[self.myTextField text]];
    }
    [self.tableViewC reloadData];
}   
  • 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-05-27T10:49:06+00:00Added an answer on May 27, 2026 at 10:49 am

    You have to write that data into the plist file and then save it. Hope you are accessing the file from the bundle of the application. Make a copy of it initially and save it the Documents directory. Then when you add the new data, save that data into the plist by writing into the plist file of the documents directory.

    [yourData writeToFile:filePath atomically:YES];
    

    Update

    See if this tutorial helps.

    EDIT

    First read the data from the plist into an array (mutable so that you can add objects to it). Then add the new data to this array using

    [yourArray addObject:someObject];
    

    Then after adding all objects write this array into the file.

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

Sidebar

Related Questions

i am having a tableview with a list of categories.i have an add button
I have a TableView that is populated with data. When a user taps a
I have to add image in tableview in each. I have 2 list one
i have a list of image categories in a tableview. i want to load
I have a tableView that present a list of Books, each of the table
I have created a TableView(Grouped Table View). And I can list the items in
I am using grouped tableview for developing a contact list using database. I have
I have a table view with a list of categories and each category (understand
I am trying to have a tableview that leads to another tableview whose list
I have tableview which holds a list of data, when users press Edit i

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.