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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:45:52+00:00 2026-05-14T07:45:52+00:00

I know that table sources need a data source to hold the data that

  • 0

I know that table sources need a data source to hold the data that the tableview will display.
Lets’ say that I’m going to make my AppController be the data source of my tableview and that I make the connection in interface builder. My question is since my actual data is going to be stored in an array,let’s call it myArray, when I set the data source in code should I do this

 [tableView setDataSource:myArray]; or this [tableView setDataSource:self];

I’m confused about this. setting the data source with the keyword “self” would set it to the AppController if I’m not mistaken.

  • 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-14T07:45:52+00:00Added an answer on May 14, 2026 at 7:45 am

    A table view data source must conform to the NSTableViewDataSource protocol (called NSTableDataSource prior to 10.6).

    NSArray does not conform to this protocol, so you can’t use it as a data source.

    You need to implement the required protocol methods in your AppController object and assign your AppController object as the table’s data source.

    - (void)applicationDidFinishLaunching:(NSNotification*)notification
    {
        [tableView setDataSource:self];
    }
    
    - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
    {
        return [myArray count];
    }
    
    - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
    {
        return [myArray objectAtIndex:rowIndex];   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several csv files that I need to transfer over to mdb format.
I need to use an Entity framework with my application, and I have used
I have a code that fetches a list from DB. Using that returned array
I developed WPF / XAML applications that invoke objects (functions or Web services) which
[I have read previous posts on MEF vs MAF vs DI etc, they aren't
I've been using Perforce for a number of years. I'd like to switch to
Following up on this question: Kiosk Applications - OS X programming - Multiple monitors
I am making an e-book reader for the J2ME and I wonder if I
My question is similar to this one but I'm having some problems with the
When apple developed the UITableView for the first iPhone they had a problem in

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.