Core Data: Detecting the type and casting it
Posted
by Tim Sullivan
on Stack Overflow
See other posts from Stack Overflow
or by Tim Sullivan
Published on 2010-03-15T20:10:00Z
Indexed on
2010/03/15
20:39 UTC
Read the original article
Hit count: 154
I have set up a Core Data model that includes an entity, Item
with a 1->M relationship with the abstract entity Place
, so that an item has many places. There are several entities with the parent set to Place
.
I want to set up several UI elements depending on the descendent place types. I have a loop that looks something like this:
for (Place *place in item.places) {
}
... but I'm not sure how to detect what type the place is, and how to cast it to the proper type so that I can access its properties.
Thanks for any help!
© Stack Overflow or respective owner