Created
June 27, 2012 20:05
-
-
Save myell0w/3006517 to your computer and use it in GitHub Desktop.
Objective-C Annotations Syntax Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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