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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:39:50+00:00 2026-06-08T23:39:50+00:00

I have an API provided NSArray with a bunch of content objects – we’ll

  • 0

I have an API provided NSArray with a bunch of content objects – we’ll call this acquiredFruit – and an empty NSMutableArray called likedFruit.

I’ve created NSArrayControllers for both arrays and bound my TableView to acquiredFruit.arrangedObjects. The first column of the tableView is bound to arrangedObjects.name and correctly shows all the delicious fruit.

I’ve created a second column with a checkbox – when the user fills the box I’d like to add the fruit to my likedFruit array. Unchecking the box should remove the fruit object from the likedFruit array.

Essentially I’d like my NSTableView to join between two array controllers. I have a feeling I should be making a single separate controller for this, but I’m unsure how to approach the problem.

I should also mention that I’m aware I could iterate through my array and construct another object with the fields I need, but my goal is to do this by using bindings, if possible.

Thoughts?

  • 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-06-08T23:39:51+00:00Added an answer on June 8, 2026 at 11:39 pm

    I think you should use one array controller.

    You can have an attribute on Fruit called liked. Now your “liked” checkbox column is connected to arrangedObjects.liked. Later, when you want to determine the set of all liked fruits, you can query your fruits array:

    NSArray * likedFruits = [ allFruitsArray filteredArrayUsingPredicate:[ NSPredicate predicateWithFormat:@"liked = YES"] ] ;
    

    If in another part of your UI you are displaying only liked fruit, you can set your array controller’s filterPredicate to the predicate above to get just those fruits.

    EDIT: Let’s say NSFruit is provided via someone else’s API. Let’s use the “General Technique for Adding Properties to Someone Else’s Class”:

    @interface NSFruit (Liking)
    @property ( nonatomic ) BOOL liked ;
    @end
    
    @implementation NSFruit (Liking)
    
    -(BOOL)liked
    {
        return [ objc_getAssociatedObject( self, "_abliked" ) boolValue ] ;
    }
    
    -(void)setLiked:(BOOL)b
    {
        objc_setAssociatedObject( self, "_abliked", [ NSNumber numberWithBool:b ], OBJC_ASSOCIATION_RETAIN_NONATOMIC ) ;
    }
    
    @end
    

    (I’ve written this same code for like 100 posts recently!)

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

Sidebar

Related Questions

I have a web application built in Django 1.3. We have also provided API
I have to deal with an API which need to be provided a DataSource
I have an API call that returns a byte array. I currently stream the
I have to use an API provided by a DLL with a header like
So, I have this public API that my application exposes, allowing customers to write
I have an API call in my application where I am checking the time
I have been trying to use the server side api provided by Urban Airship
I see many Java packages have api, impl and bundle jars (name-api.jar, name-impl.jar, name-bundle.jar).
I have an api which takes uni code data as c character array and
We have an API built on Rails, and processing some stuff with resque. After

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.