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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:02:42+00:00 2026-05-13T19:02:42+00:00

I’m trying to implement something similar to the iTunes browser, to browser a simple

  • 0

I’m trying to implement something similar to the iTunes browser, to browser a simple database of Books. I have the following entities – Author, Genre and Book. I would like to display an author list and a genre list, which act to filter the main Book list.
I have tried doing this in 2 different ways – modeled as:

Author ( has many ) Genres ( has many ) Books

…with multiple instances of the same Genre so each author has their own for a given genre name, I have a nice drill-down hierarchy to display in my table views (albeit a bit illogical to duplicate Genres). However, when I select multiple Authors, I end up displaying dupes of the same Genre, because they are, in fact, distinct objects.

So, I tried doing it, more sensibly, with these relationships:

Author ( has many ) Books  
Book ( has one ) Genre

I can get the Genre array by taking the distinct union of Genre’s in the current selected Author(s) book array, but now i’m left with the problem of filtering the book list displayed based on the selected Genre(s). Because the Genre’s are shared, I can’t just use CurrentGenre.books, or I lose the selected Author filtering. I have noticed the ‘filter predicate’ field in interface builder, available on the object controllers, but am stuck working out how to actually use it to apply the selected Genre as a filter to an episode list. The apple documentation says:

“You can type a predicate directly
into the predicate editor text field
in the inspector panel of Interface
Builder or you can set it
programmatically using
setFetchPredicate:.

which gives me the impression i’m on the right track, but that’s about the end of it. I’m trying to lock down the model in a nice Cocoa-esque fashion now, so as to minimize ‘glue code’ bits and changes later down the track. It seems like a fairly simple problem I should be able to sort out graphically in IB, but so far it’s eluded me!

Thanks in advance.

  • 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-13T19:02:43+00:00Added an answer on May 13, 2026 at 7:02 pm

    I am a bit confused by your introducing “episodes” in the middle of the discussion, but I will assume you just mean “books” still.

    You are definitely on the right track. You want a data model like this:

    Author <–>> Book
    Genre <–>> Book

    Or maybe even:
    Author <<–>> Book (if you support reference books, etc)
    Genre <<–>> Book (if you want multi-genre support)

    Once a user has selected author(s) and genre(s) you will want a Book array controller to use a filter predicate that only shows books with those author(s) or genre(s).

    UPDATE
    This should work:

    1. Bind the Book array controller’s filter predicate to a new predicate property “bookFilterPredicate” in your app delegate.
    2. Add outlets for the Author and Genre array controllers.
    3. Observe changes to the selectedObjects properties of both array controllers.
    4. When either changes, update the filter predicate property like this: self.bookFilterPredicate = [NSPredicate predicateWithFormat:@"author IN %@ && genre IN %@",authorArrayController.selectedObjects,genreArrayController.selectedObjects];
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6

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.