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?

有帮助吗?

解决方案 2

arrayController.arrangedObjects[index].title = newValue;

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top