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

  • SEARCH
  • Home
  • 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 7015067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:36:15+00:00 2026-05-27T22:36:15+00:00

I am having table view in my iPhone application. The requirement is that I

  • 0

I am having table view in my iPhone application. The requirement is that I have to use gestures for that table view so that when user tap+hold on a row then a dialogue box should come up confirming user to save the data of that specific row to iPhone core data or nsuserdefaults.

I want to know that what option would be the best to save the data i.e., core data or nsuserdefaults?

And the most important How can I achieve it?

I need any example or code snippet to get accomplish this…

thanx

  • 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-27T22:36:15+00:00Added an answer on May 27, 2026 at 10:36 pm

    I would go for NSUserDefault if I am sure that will be no more than 10-20 rows of data, otherwise I would go for CoreData so it can be scaled in the future. I would use the LongPressGestureRecognizer in the cell to get the indexPath of the cell and display the dialog as shown in sample code below.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    { 
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
            UILongPressGestureRecognizer *pressRecongnizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(tableCellPressed:)];
                pressRecongnizer.minimumPressDuration = 0.5f;
                [cell addGestureRecognizer:pressRecongnizer];
                [pressRecongnizer release];
        }
        // your cell info
        cell.textLabel.text = @"test";
        return cell;
    } 
    
    - (void)tableCellPressed:(UILongPressGestureRecognizer *)recognizer
    {
        // You can access to the tableview cell from the recognizer.view
        // You can get the data directly from the cell data more or label and etc.
        UITableViewCell *cell = (UITableViewCell *)recognizer.view;
    
        // You can either get the NSIndexPath of the cell from the tableview to 
        // access the data model from you data collection.
        NSIndexPath *indexPath = [self.tableview indexPathForCell:cell]
    
        // Use the index path to get data and display dialog.
        // For example:
        UIAlertView *alert = [UIAlertView alloc] – initWithTitle:@"table cell pressed" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table view that is managed by an NSFetchedResultsController. I am having
In my iPhone app, I am having a grouped table view. I have used
I'm having a table and i have a row which is initially set to
My iphone App shows a table view having list of 6000 items. (these items
I have an iPhone app that uses a UINavigationController, some table views, and iAd.
I'm having some trouble with an iPhone app that I'm making. I have two
Having an interesting little problem with my iPhone app. I have a view with
I am having a table view with titles in each row. Now i need
I have a basic view that returns the same columns as a table (give
Having a table with a column like: mydate DATETIME ... I have a query

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.