ABC *abc=[ABC new];
id property=abc.property;
but:
id ClassName=NSClassFromString(ABC);
id instance=[ClassName new];
id property=???????;
i can't use instance.property,because it is id type.
i want to get a known property from (id)type class.
i try to use:
[aInstanse propertyForKey:<#(NSString *)#>];
[aInstanse propertyNamed:<#(NSString *)#>];
But Program crashes...
can you help me, thanks.
You can just use the standard getters and setters, which default properties have and which
@synthesize
will create:If you're sure that your class has some properties, and you know name of this properties, you can make an interface to call it. Of course, you have to cast your object to an object of this class!
Good luck!
there are many ways
you can cast it if you know the type at compile time
or not using dot syntax
or using
valueForKey: