Hello,
How to load a class in Objective-C for iPhone application? I know tat Bundling concept is in MAC , but for iPhone can i use the same bundle concept to load a class?
Hello,
How to load a class in Objective-C for iPhone application? I know tat Bundling concept is in MAC , but for iPhone can i use the same bundle concept to load a class?
What do you want to load? If you want to load a class from a nib you'd simply do something like:
YourClassName *classInstance = [[YourClassName alloc] initWithNibName:@"YourClassName" bundle:Nil];
Only some classes will implement the initWithNibName, such as UIViewControllers. You can also load a class from a nib from your bundle to an owner using the following:
[[NSBundle mainBundle] loadNibNamed:@"YourClassName" owner:self options:nil];
I use the way as follows
Class c = NSClassFromString( YourClassNameHere );
YourClass* ojectInstance = [c new];