I have name of class in string Format. And i want to make Object of that class. As well as i have the name of data member in string.
How to make object of that class ? How to access property of that class ?
I have name of class in string Format. And i want to make Object of that class. As well as i have the name of data member in string.
How to make object of that class ? How to access property of that class ?
To create an instance of a class based on the class name:
Class MyClass = NSClassFromString(@"Person");
id someObj = [[MyClass alloc] init];
To access a property of an object by name (key):
NSString *firstName = [someObj valueForKey:@"firstName"];
You can also modify a property of an object by name (key):
[someObj setValue:@"Freddy" forKey:@"firstName];