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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:14:04+00:00 2026-05-27T10:14:04+00:00

I am a .net developer that’s trying to learn how to do cocoa programming

  • 0

I am a .net developer that’s trying to learn how to do cocoa programming on a mac. I have run into a problem that I can’t seem to figure out or find an answer for.

I have created the following classes:

  • ITObject – subclass of NSObject
  • ITPlayer – subclass of ITObject
  • ITEnemy – subclass of ITObject

In my MainMenu.xib file I have a window that contains the following controls:

  • NSArrayController – linked to App Delegate (itObjects)
  • NSTableView – linked to a NSArrayController (arrangedObjects)
  • NSTextBox – linked to the same NSArrayController (selection.player)

itObjects is an NSMutableArray that I use to contain any ITObject classes. The NSArrayController was set to use ITObject as the class. When I add a ITPlayer to the itObjects property, the text box doesn’t read the player property.

The player property is unique to ITPlayer. If the player property is not part of the class, I want to display ‘N/A‘ in the text box, if it is there, I want the binding to show the value. Right now, it does nothing.

More information on the objects:

The code for the items looks like this:

@interface ITObject:NSObject <NSCoding>{ 
     int initiativeRoll, initiativeBonus, initiativeKicker;
}
@property int initiativeRoll, initiativeBonus, initiativeKicker;
@property (readonly) int initiativeTotal, initiativeCalc;
@end

That is the header file for the ITObject (obviously). The ITEnemy and ITPlayer are setup like this (only so far).

@interface ITPLayer:ITOjbect <NSCoding>{
     NSString *player;
}
@property (copy) NSString *player;
@end

The init method for the ITPlayer is setup in the implementation file like this:

- (void)init{
     self = [super init]
     if (self){
          player = @"undefined";
     }
     return self;
}

There is also a initWithCoder: method, but I haven’t been using that yet, so I don’t think that this is suspect.

Thank you very much for your 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-27T10:14:05+00:00Added an answer on May 27, 2026 at 10:14 am

    I typically do not recommend bindings, and definitely not complicated bindings, to new Cocoa developers. Bindings have the unfortunately situation of tending to “do nothing” when they are the least-bit misconfigured. This makes them very difficult to debug, even for experienced developers. Bindings work very well when dealing with a big page of configuration options tied to NSUserDefaults, but they’re a pain to build a complicated UI out of.

    That to the side, your setup seems very odd. The owner of MainMenu.xib should almost always be a NSApplication. Instead of what you’re doing, you should drag a new NSArrayController onto your XIB and wire it up as you’ve described, but not make it the file owner.

    I would expect that you’re seeing exceptions in your log. Probably “NSArrayController does not respond to selector setDelegate:” or the like. If you’re seeing this, it’s because the default MainMenu nib file is configured to wire the application delegate to the file owner.


    First, just a little quote from the Apple docs to reinforce the point about bindings:

    Populating a view-based table view using Cocoa bindings is considered an advanced topic. While it requires significantly less code (in some cases no code at all), the bindings are hard to see if you are not familiar with the interface. It is sternly suggested that you are comfortable with the techniques for using view-based table views programmatically before you move on to Cocoa bindings.

    I love the word “sternly” in this section. After years of development with and without bindings, I tend to avoid them except in the simplest of cases (like preference panels, where they’re incredibly useful).

    Without bindings, you would follow the instructions in Populating View-Based Table Views Programmatically. Basically, you will implement numberOfRowsInTableView: and (assuming 10.7+) tableView:viewForTableColumn:row:. For each row and column you return a view containing the data you want. This is taken from the iOS way of doing things and is very nice and extremely flexible.

    If you need pre-10.7, then things are slightly more complicated, but still more straightforward than bindings. See Populating Cell-Based Table Views. This uses NSCell rather than NSView. If you just need a simple table displaying string-like data, it’s not hard. Just implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:. The latter should return something that can be coerced into a string.

    If you need a custom NSCell for pre-10.7, try it out on your own using the docs, and then you’ll probably have some new questions to post.

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

Sidebar

Related Questions

I'm a .NET developer and I need to learn Lucene so we can run
I'm a C# .NET developer. I want to develop mobile apps that can run
I'm a .Net developer but I have a situation where I can't guarantee that
I'm a .Net developer moving from Winforms to WPF and have run into a
I am a .Net developer who need to port a small project into Mac,
I'm a Silverlight/ASP.NET developer trying to write my first Windows Forms application to run
I'm a .NET developer starting to dig into an android application. One thing that
I am a .Net developer that has been tasked with upgrading a classic asp
I am primarily a .NET developer, and in that sphere alone there are at
Is there guide out there that will help me, A .Net developer whose been

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.