I have a view controller alike contacts in iPhone. The code is something like this,
tabBarController = [[UITabBarController alloc] init];
friendsVC = [[RemittanceFriendsVC alloc] initWithNibName:@"RemittanceFriendsView" bundle:nil];
friendsVC.friendsArray = [[RemittanceModel getInstance] friends];
UINavigationController *friendsNVC = [[UINavigationController alloc] initWithRootViewController: friendsVC];
[controllers addObject:friendsNVC];
tabBarController.viewControllers = controllers;
The RemittanceFriendsVC is UITableViewController, clicking on a cell takes to details view. I have 'modal' variable set in the ViewController (VC)to know if its loaded as modal or not. Since its part of a tab bar item, (non modal view) it works fine. But when I am loading it as modal VC, when I click on a table cell, I want to dismissmodalview, but it did not dismiss the modal view.
In the friendVC this is not working,
-(void) didPressCancelButton {
[self.navigationController dismissModalViewControllerAnimated:YES];
}
What I wanted to do is, use the same VC as a tab bar item and sometime as a modal VC. Isn't it possible?