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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:02:21+00:00 2026-05-30T11:02:21+00:00

I have an NSTableView, the content of which is bound to an arrayController using

  • 0

I have an NSTableView, the content of which is bound to an arrayController using a filterPredicate. The tableView is view-based, so its delegate is set to an object that has the

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row 

method. I’m getting odd behavior, which may be related to my observation that this method is being called even when the controller’s number of arrangedObjects is 0. Moreover, each time the method is called, the number of rows it asks for is the total number of objects in the array controller’s content (as opposed to arrangedObjects). It think it may be because of this that when I set the objectValue of the cellView requested using

cellView.objectValue = [arrayController arrangedObjects] objectAtIndex:row];

that it is often the wrong one. Any ideas?

  • 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-30T11:02:22+00:00Added an answer on May 30, 2026 at 11:02 am

    Well, I still can’t explain why the view was behaving as it was, but I did manage to get things to behave correctly, doing the following:

    • binding tableView content to arrayController’s arrangedObjects
    • binding various elements of the tableCellview used in the tableView to the appropriate keyPath of the tableCellView’s objectValue
    • providing each tableCellView as follows (where BILSelectableRoundedTableCellView happens to be a subclass of NSTableCellView):

      (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
      
      NSInteger numberOfObjects = [self.arrayController.arrangedObjects count];
      
      if (numberOfObjects == 0)
          return nil;
      
      if (row >= numberOfObjects)
          return nil;
      
      BILSelectableRoundedTableCellView *viewForTableColumnRow = [self.myTableView makeViewWithIdentifier:@"DataCell" owner:self];
      
      return viewForTableColumnRow; }
      

    Finally, using a datasource that implements the following:

    (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
    
    NSInteger numberOfObjects = [self.arrayController.arrangedObjects count];
    
    if (numberOfObjects == 0)
        return nil;
    
    if (row >= numberOfObjects)
        return nil;
    
    return [self.arrayController.arrangedObjects objectAtIndex:row]; }
    

    The use of the later seems contrary to the documentation out there, but is necessary to get things to work properly. Interestingly, the other datasource method (numberOfRowsInTableView) is not called when using bindings, although it is called when i’m not using bindings.

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

Sidebar

Related Questions

I have an NSTableView which is bound to an NSDictionaryController. I have set this
I have a custom NSTableView subclass which is bound to a data source (an
I have an application with a view-based NSTableView in it. Inside this table view,
I have an NSTableView which displays some information representing a custom object of mine.
I have an NSTableView that is done using the typical IB and data bindings.
I currently have a NSArrayController whose content property is (programmatically) set to an NSMutableDictionary
I have NSTableView object. I need to invoke the menu associated with it at
Current Situation: Direct Binding I have an NSTableView which displays the data that comes
I have a NSArrayController bound to an NSTableView so the table column like the
I have an NSTableView which I wish to allow users to drag-and-drop video files

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.