0

Following a guide on the Apple Core Data I deployed my application to the two table view. The first creates the group of holidays, the second includes all the festivities of the group previously created. The technique is one of the bindings. The tables view are connected to two Array Controller. The first Array Controller manages the entity of the group of holidays, the second manages the entity of individual festivals and has two attributes: name and dates. Now I need to get the dates contained in the Array to use in the application. What is the easiest way?

1 Answer 1

1

Without following the tutorial myself I can't actually comment on your implementation but I can comment generally.

Perhaps you want to itterate over the selectedObjects?

    // When bound to a row, 1 object = 1 row
    for (Entity *entity in arrayController_.selectedObjects) {
        // Use your entity here ie:
        NSLog(@"The entity's date is %@", entity.date);
    }

Alternatively you can bind a value to the objectValue of the TableCellView

1. Select the TableCellView
2. Add a label
3. Bind the value of the new label to the TableCellView
4. Set the Model Key Path to 'objectValue.date' 

Hope this helps

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for the reply. I tried adding your code but I get compile errors, I'm sure I'm wrong. My entity is called "FesteGruppo"and the attribute is called "date". How can I adapt your code?
Have you included the entity header in the object file, ie: at the top of your .m file you should have #import "FesteGruppo.h"? The for loop should be something like for (FesteGruppo *festeGruppoEntity in ...)
Hello, I did as you said and the situation has improved, but there's still a compile error: Use of undeclared identifier "arrayController_" did you mean "NSArrayController"? How can I fix this?
When you create an object in Interface Builder that object exists only within the scope of the XIB file. To access it you need to make an IBOutlet and connect it. In your .h file create an ivar along of the lines of: IBOutlet NSArrayController *arrayController_;, in Interface Builder CTRL-drag the Array Controller to the Files Owner, selecting this outlet. Checkout Youtube too!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.