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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:59:14+00:00 2026-05-26T17:59:14+00:00

I’m a beginner when it comes to writing Mac apps and working with Cocoa,

  • 0

I’m a beginner when it comes to writing Mac apps and working with Cocoa, so please forgive my ignorance.

I’m looking to create a custom view, that exposes some properties, which I can then bind to an NSObjectController. Since it’s a custom view, the Bindings Inspector obviously doesn’t list any of the properties I’ve added to the view that I can then bind to using Interface Builder.

After turning to the Stackoverflow/Google for help, I’ve stumbled across a couple of possible solutions, but neither seem to be quite right for my situation. The first suggested creating an IBPlugin, which would then mean my bindings would be available in the Bindings Inspector. I could then bind the view to the controller using IB. Apparently IBPlugins aren’t supported in Xcode 4, so that one’s out the window. I’m also assuming (maybe wrongly) that IBPlugins are no longer supported because there’s a better way of doing such things these days?

The second option was to bind the controller to the view programmatically. I’m a bit confused as to exactly how I would achieve this. Would it require subclassing NSObjectController so I can add the calls to bind to the view? Would I need to add anything to the view to support this? Some examples I’ve seen say you’d need to override the bind method, and others say you don’t.

Also, I’ve noticed that some example custom views call [self exposeBinding:@"bindingName"] in the initializer. From what I gather from various sources, this is something that’s related to IBPlugins and isn’t something I need to do if I’m not using them. Is that correct?

I’ve found a post on Stackoverflow here which seems to discuss something very similar to my problem, but there wasn’t any clear winner as to the best answer. The last comment by noa on 12th Sept seems interesting, although they mention you should be calling exposeBinding:. Is this comment along the right track? Is the call to exposeBinding really necessary?

Apologies for any dumb questions. Any help greatly appreciated.

  • 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-26T17:59:14+00:00Added an answer on May 26, 2026 at 5:59 pm

    The first suggested creating an IBPlugin, which would then mean my bindings would be available in the Bindings Inspector. I could then bind the view to the controller using IB. Apparently IBPlugins aren’t supported in Xcode 4, so that one’s out the window.

    Correct. Interface Builder is dead; long live the Xcode nib editor (which they still call Interface Builder sometimes).

    With IB gone, so are IBPlugins.

    I’m also assuming (maybe wrongly) that IBPlugins are no longer supported because there’s a better way of doing such things these days?

    Nope.

    The second option was to bind the controller to the view programmatically. I’m a bit confused as to exactly how I would achieve this.

    Send the view a bind:toObject:withKeyPath:options: message.

    Would it require subclassing NSObjectController so I can add the calls to bind to the view?

    Not NSObjectController, but something that either owns the nib (such as a window controller or view controller) or is a top-level object inside it (such as the application’s delegate in the MainMenu nib).

    Would I need to add anything to the view to support this?

    See below.

    Some examples I’ve seen say you’d need to override the bind method, and others say you don’t.

    You used to, for non-views (views always worked without overriding it), but not anymore. You no longer need to override the bind:::: method.

    I don’t know when this changed, but I wrote a test app to confirm the current behavior (as of Snow Leopard and Lion).

    Also, I’ve noticed that some example custom views call [self exposeBinding:@"bindingName"] in the initializer. From what I gather from various sources, this is something that’s related to IBPlugins and isn’t something I need to do if I’m not using them. Is that correct?

    Nope.

    You don’t need to override bind:::: to bind to any KVC-/KVO-compliant property, and you don’t need to send exposeBinding:.

    Confusingly, the documentation says otherwise: that you must override bind:::: and unbind:, even in views, and that exposeBinding: is useful for anything.

    All you have to do to create an available binding is implement a KVC-/KVO-compliant property. If it’s a synthesized @property, this is done. Otherwise, see here.

    Then, send the view/object a bind:::: message to actually bind it, since there’s no way to expose the binding in the nib editor.

    TL;DR:

    Just implement a regular property, and you’ll be able to bind it with a bind:toObject:withKeyPath:options: message (at least in Snow Leopard and Lion). You don’t need to send exposeBinding: from anywhere anymore. You can’t make custom bindings show up in the nib editor in Xcode 4.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am writing an app with both english and french support. The app requests
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.