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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:26:41+00:00 2026-05-25T14:26:41+00:00

In Xcode 4 I created a new Cocoa application called Tabletest , on the

  • 0

In Xcode 4 I created a new Cocoa application called Tabletest, on the xib I added a NSTableView and control-dragged it to the app’s delegate object (created automatically when you create the new Cocoa app). I set the table’s dataSource and delegate to the app’s delegate object called Tabletest App Delegate.

On tabletestAppDelegate.h and tabletestAppDelegate.m I added the (apparently) required

- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;

- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
    return (int)[myArray count];
}

- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
    return [myArray objectAtIndex:row];
}

and declared an NSMutableArray like NSMutableArray * myArray;
Then I control-dragged the table to the .h and created a property like:

@property (assign) IBOutlet NSTableView *myTable;

On the .m file I added the implementation of numberOfRowsInTableView and (id)tableView...

and added:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    myArray = [[NSMutableArray alloc] initWithCapacity:10];
    int i = 0;
    for(i=0; i<10;i++) 
    {
        [myArray insertObject: [NSString stringWithFormat:@"This is string %d!",i+1] atIndex:i];
    }

    NSEnumerator * enumerator = [myArray objectEnumerator];
    id element;

    while((element = [enumerator nextObject]))
    {
        // Do your thing with the object.
        NSLog(@"%@", element);
    }

}

The `NSLog show the array gets filled but the info never shows on the table. What am I missing? I am a complete newbie on Cocoa and I have no idea why adding information to a simple table is so complicated.

Thank for the help.

  • 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-25T14:26:42+00:00Added an answer on May 25, 2026 at 2:26 pm

    I’ll answer my own question, add

    [_myTable reloadData];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a new project in Xcode 4 using the Cocoa Application template and
When you create new Cocoa application Xcode generates MainMenu.xib for you with the sets
I've created a new View-based Application in XCode. In the ViewController, the only code
Environment: xcode 3.2.1, document-based core-data application. I have a document-based cocoa app which uses
When I create a new cocoa project in Xcode, it creates a MainMenu.xib file
Using XCode 4, I created a NEW TabBar Application using the default storyboard settings.
How would I change the initial templates created by Xcode when creating a new
I've created an application using the Navigation-based template in Xcode. I've also created a
I just created a new Xcode project. In the AppControl class Header file I
When you create a new application in Xcode, it automatically creates a AppDelegate and

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.