Search code examples
objective-cdictionaryif-statementmkmapviewmkpinannotationview

If X is a subclass of Y objective-c


What is the syntax to say

if (object isObjectOfClass Class){ object.color = 1; }

I'm making a map application and i want to say "if this point on the map is a branch of THIS store- set the pin picture as this"


Solution

  • if([myObj isKindOfClass:[MyClass class]]) {
       // ...
    }