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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:56:15+00:00 2026-06-04T23:56:15+00:00

I’m trying to pretty closely mimic the functionality of the iPhone phone app recent

  • 0

I’m trying to pretty closely mimic the functionality of the iPhone phone app recent calls TableView, using an NSTableView on OS X. The desired functionality is that you click a button and the TableView switches from showing you all the recent calls to showing the subset of those calls that were missed, AND, I want to have the animation that you see on the iPhone where the appearance and disappearance of the rows is animated.

I’m using a view based NSTableView and I have it wired up very simply with a manual data source and delegate in my view controller (not using cocoa bindings).

Everything is working except when trying to delete rows to show the subset of “missed” calls. If I just reconstruct the NSMutableArray that is the data source for the TableView and then call reloadData, it works perfectly. But that gives me no animation. Here is the unanimated version which results in the TableView and the data source NSMutableArray in perfect sync, the correct content in the TableView, but no animation:

- (IBAction)showMissed:(id)sender {    
  NSMutableIndexSet *indices = [NSMutableIndexSet indexSet];
  Call *call;

  for (call in callsArray) {
    if (!call.missed) {
      [indices addIndex:[callsArray indexOfObject:call]];
    }
  }
  if ([indices count] > 0) {
    [callsArray removeObjectsAtIndexes:indices];
    [self.recentsTableView reloadData];
  }
}

When I try to use the NSTableView removeRowsAtIndexes:indices withAnimation: method to get the animation I want, I am getting some very strange behavior. Here is the animated showMissed method:

- (IBAction)showMissed:(id)sender {    
  NSMutableIndexSet *indices = [NSMutableIndexSet indexSet];
  Call *call;

  for (call in callsArray) {
    if (!call.missed) {
      [indices addIndex:[callsArray indexOfObject:call]];
    }
  }
  if ([indices count] > 0) {
    [callsArray removeObjectsAtIndexes:indices];
    [self.recentsTableView removeRowsAtIndexes:indices withAnimation:NSTableViewAnimationSlideUp];
  }
}

The logic I am using in the animated version of the method is pulled out of Apple’s TableViewPlaygound sample code.

When I run this code, I get two strange results. First, the TableView does not show only “missed” calls — it shows the right number of rows (i.e. the number of rows in the TableView equals the number of Call objects marked as missed), but the actual objects showing in the rows are some missed and some not missed.

Even weirder though is that after the animated version runs, the callsArray has ALL of the Call objects in it, as though the [callsArray removeObjectsAtIndexes:indices]; statement was not there at all. It seems like somehow the removeRowsAtIndexes:indices withAnimation: method is messing with the contents of my data source array and throwing the whole thing out of whack.

FWIW, my animated showAll method which is basically the reverse of the above using the insertRowsAtIndexes:indices withAnimation: seems to work perfectly.

What am I doing wrong?

  • 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-04T23:56:17+00:00Added an answer on June 4, 2026 at 11:56 pm

    There must have been some corruption somewhere in the sync between the data source array and the tableView. I fixed it by adding a reloadData call at the top of the method. Here is the fixed showMissed method:

    - (IBAction)showMissed:(id)sender {    
      NSMutableIndexSet *indices = [NSMutableIndexSet indexSet];
      Call *call;
    
      [self.recentsTableView reloadData];
    
      for (call in callsArray) {
        if (!call.missed) {
          [indices addIndex:[callsArray indexOfObject:call]];
        }
      }
      if ([indices count] > 0) {
        [callsArray removeObjectsAtIndexes:indices];
        [self.recentsTableView removeRowsAtIndexes:indices withAnimation:NSTableViewAnimationSlideUp];
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

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.