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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:10:54+00:00 2026-05-11T05:10:54+00:00

What is considered the best way of handling multiple NSTableViews without using Cocoa Bindings?

  • 0

What is considered the best way of handling multiple NSTableViews without using Cocoa Bindings?

In my app, I have two NSTableViews that are sufficiently closely related that I’m using the same object as the delegate and dataSource for both. The problem is both tableViews invoke the same methods. I currently discriminate between the two tableViews on the basis of NSControl -tag.

The deeper I get into this code, the uglier the use of -tag looks. I end up creating largely duplicate code to distinguish between the tableViews in each delegate/dataSource method. The code ends up being distinctly non-object oriented.

I could create a separate object to handle one or the other tableView, but the creation of said object would be a largely artificial construct just to provide a distinct delegate/dataSource.

Is everyone just using Cocoa Bindings now? I’m avoiding Bindings as I would like to hone my Cocoa skills on techniques that are transferrable between Mac OS and iPhone.

  • 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. 2026-05-11T05:10:54+00:00Added an answer on May 11, 2026 at 5:10 am

    Every delegate/dataSource method for NSTableView passes the instance of NSTableView that’s calling it as the first parameter (except for the ones that pass NSNotification objects, in which case the NSNotification’s object is the table view instance). Some examples include:

    - (int)numberOfRowsForTableView:(NSTableView*)aTableView;

    - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex

    - (void)tableViewSelectionDidChange:(NSNotification *)aNotification

    If you’re using one controller object as a delegate/data source for multiple tables, you can just use that parameter to differentiate between them.

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

Sidebar

Related Questions

Is there a way in Cocoa that is currently considered best practice for creating
What is currently considered the best way to clear CSS floated elements that will:
I have been struggling with the best way to make sure that the certain
What is currently the best way to authorise users of a Rails app using
What is considered the best way to expose a type to another application over
Three SHA512Managed related questions: Is SHA512Managed considered the best one-way hash available in .NET
Would it be considered best practice to use a single template that changes it's
I'm using VB's StringBuilder, and I was curious what is considered best practice for
What is the best way to organize code that belongs to the same project
What's the best way to link back to the page that a user has

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.