首页 > 技术文章 > 类名和字符串之间的转换(实现动态编码)

zhiupping8 2015-10-27 15:51 原文

类名转换成字符串

NSClassFromString(@"class")

字符串转换成类

NSStringFromClass([self class]);

实例

id VC = [[NSClassFromString([self.sourceArray objectAtIndex:indexPath.row]) alloc] init];
[self.navigationController pushViewController:VC animated:YES];

 

 

 

推荐阅读