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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:29:08+00:00 2026-06-02T17:29:08+00:00

I have a table view where I’d like to deselect either the previously selected

  • 0

I have a table view where I’d like to deselect either the previously selected cell when returning to it from a detail view or the newly added cell when the user creates an item.

However, since sometimes new items are added, the table is refreshed by calling reloadData in viewWillAppear:. This means none of the cells are selected when the view appears, even if I have self.clearsSelectionOnViewWillAppear = NO.

By selecting and deselecting the cell after the table view appears (in viewDidAppear:) the timing of the deselect animation is visibly different to the user (try for yourself, it’s slower and doesn’t feel as slick).

How should I be preserving the selection even after the table view is refreshed? (Please keep in mind, depending on the situation, I’d like the deselect either the previously selected cell or the newly created cell.) Or should somehow I be reloading the data in my table differently?

  • 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-02T17:29:09+00:00Added an answer on June 2, 2026 at 5:29 pm

    You could save the NSIndexPath from the - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath method and when the view reloads deselect that row.

    Another way of doing this could be by passing the NSIndexPath and the current UITableViewController to the UIViewController you’re creating and when that UIViewController is popped, you deselect the specific row.

    When a new item is created, add one to the indexPath’s row element to deselect the right row.

    You could also reload only the rows that have changed:

    [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                          withRowAnimation:UITableViewRowAnimationNone];
    
    [self.tableView selectRowAtIndexPath:indexPath 
                                animated:NO
                          scrollPosition:UITableViewScrollPositionNone];
    
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    • 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 pushes to a detail view controller. From the
I have a table view controller with custom cells. In those cells i added
I have my table view and the cells within it have the UILongPressGestureRecognizer added
how can i know what tableview cell was selected?(being in the detail view) The
I have a table view that has many cells. Each cell has its own
I have a table view, and if a certain row is tapped, the detail
I have a table view and if we touch a cell a video plays.
I have table view which is populated from an array grabbed from a url.
I have table view cells with cell image and text label and detailed label.
I have a table view and it is load from table view cells. But

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.