Last active
December 26, 2015 04:49
-
-
Save cocoajin/7096073 to your computer and use it in GitHub Desktop.
创建一个类从NSString字条串
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *className = [item[kItemKeyClassPrefix] stringByAppendingString:@"ViewController"]; | |
if (NSClassFromString(className)) { | |
Class aClass = NSClassFromString(className); | |
id instance = [[aClass alloc] init]; | |
if ([instance isKindOfClass:[UIViewController class]]) { | |
[(UIViewController *)instance setTitle:item[kItemKeyTitle]]; | |
[self.navigationController pushViewController:(UIViewController *)instance | |
animated:YES]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment