Get string value of class propery names in Objective-C
Posted
by Flash84x
on Stack Overflow
See other posts from Stack Overflow
or by Flash84x
Published on 2010-06-08T21:28:58Z
Indexed on
2010/06/08
21:32 UTC
Read the original article
Hit count: 317
objective-c
|iphone-sdk
I have the following class definition.
Contact.h
#import <CoreData/CoreData.h>
@interface Contact : NSManagedObject
{
}
@property (nonatomic, retain) NSString * City;
@property (nonatomic, retain) NSDate * LastUpdated;
@property (nonatomic, retain) NSString * Country;
@property (nonatomic, retain) NSString * Email;
@property (nonatomic, retain) NSNumber * Id;
@property (nonatomic, retain) NSString * ContactNotes;
@property (nonatomic, retain) NSString * State;
@property (nonatomic, retain) NSString * StreetAddress2;
@property (nonatomic, retain) NSDate * DateCreated;
@property (nonatomic, retain) NSString * FirstName;
@property (nonatomic, retain) NSString * Phone1;
@property (nonatomic, retain) NSString * PostalCode;
@property (nonatomic, retain) NSString * Website;
@property (nonatomic, retain) NSString * StreetAddress1;
@property (nonatomic, retain) NSString * LastName;
@end
Is it possible to obtain an array of NSString objects with all of the properties by name?
Array would look like this...
[@"City", @"LastUpdated", @"Country", .... ]
© Stack Overflow or respective owner