- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Class clazz = NSClassFromString([items_ objectAtIndex:indexPath.row]);
id viewController = [[clazz alloc] init];
if (viewController) {
[self.navigationController pushViewController:viewController animated:YES];
}
}
消息转发、运行时为类添加方法、运行时替换类方法的实现,枚举类的方法和属性,获得方法的签名信息等等,都算运行时编程。
枚举类的方法?类别是在运行时进行的
{
Class clazz = NSClassFromString([items_ objectAtIndex:indexPath.row]);
id viewController = [[clazz alloc] init];
if (viewController) {
[self.navigationController pushViewController:viewController animated:YES];
}
}
消息转发、运行时为类添加方法、运行时替换类方法的实现,枚举类的方法和属性,获得方法的签名信息等等,都算运行时编程。
枚举类的方法?类别是在运行时进行的