Pass a class as a parameter?
- by JuBu1324
I have been lead to believe that it is possible to pass a class as a method parameter, but I'm having trouble implementing the concept. Right now I have something like:
- (id)navControllerFromView:(Class *)viewControllerClass
title:(NSString *)title
imageName:(NSString *)imageName
{
viewControllerClass *viewController = [[viewControllerClass alloc] init];
UINavigationController *thisNavController =
[[UINavigationController alloc] initWithRootViewController: viewController];
thisNavController.tabBarItem = [[UITabBarItem alloc]
initWithTitle: title
image: [UIImage imageNamed: imageName]
tag: 3];
return thisNavController;
}
and I call it like this:
rootNavController = [ self navControllerFromView:RootViewController
title:@"Contact"
imageName:@"my_info.png"
];
What's wrong with this picture?