Question

I have Core Data entity named Event in my xcdatamodeld with 2 attributes : title and date. I have also an arrayController set to Entity mode with the Event entity (done with interface builder). I want to access the attributes of the objects in the arrayController using code. How can I do that?

Était-ce utile?

La solution 2

arrayController.arrangedObjects[index].title = newValue;

Autres conseils

I agree with the other posters about looking into some of the docs on core data. The Big Nerd Ranch books are a really great starting point if you find the online documentation overwhelming (it comes in time).

Select your Event entity in your xcdatamodel, then from the menu do: Editor > Create NSManaagedObject Subclass

Then you can do: Event *event = [arrayController.arrangedObjects[index]]; event.title = newValue or [event setTitle];

I suggest starting with the Apple tutorial, Core Data Tutorial for iPhone OS, then moving on to one of the sample apps, such as CoreDataBooks. Core Data is not an easy technology to master, so expect this to take some time.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top