I want to click tab bar to pop up a modal view not just view controller.
(Like Instagram's camera tab bar to pup up camera view)
However when I drag from navigation controller to another view controller
I always got a black view when I run the app if I choose present modally.
So now, I can only choose root view controller.
Sorry for my poor English !
Can anyone understand and help me ?
The easiest way is to subclass uitabbarcontroller and use its delegate:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if ([viewController isKindOfClass:[SomeVC class]]) {
[self.navigationController presentViewController:vcToPresentModal animated:YES completion:NULL];
return NO;
}
return YES;
}
The main idea is to catch selection of some vc(it could be just empty UIViewController, connected with item, where should be modal presentation), cancel it,and show a modal vc.