Skip to content

Instantly share code, notes, and snippets.

@satoshin2071
Created April 13, 2014 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satoshin2071/10582968 to your computer and use it in GitHub Desktop.
Save satoshin2071/10582968 to your computer and use it in GitHub Desktop.
[objC]文字列からインスタンス生成
- (id)createWithClassName:(NSString*)title
{
NSString *className = [NSString stringWithFormat:@"%@ViewController",title];
Class aClass = NSClassFromString(className);
id instance = nil;
if (aClass) {
instance = [[aClass alloc]init];
}
return instance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment