Skip to content

Instantly share code, notes, and snippets.

@myell0w
Created June 27, 2012 20:05
Show Gist options
  • Save myell0w/3006517 to your computer and use it in GitHub Desktop.
Save myell0w/3006517 to your computer and use it in GitHub Desktop.
Objective-C Annotations Syntax Example
@interface AnnotationTest : NSObject
@MyAnnotation (type="surname")
@property (nonatomic, copy) NSString *name;
@end
@implementation AnnotationTest
- (void)test {
for (Annotation annotation in self.name.annotations) {
if ([annotation isKindOfAnnotation:@annotation(MyAnnotation)]) {
MyAnnotation myAnnotation = (MyAnnotation *)annotation;
NSLog(@"%@", myAnnotation.type);
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment