I have a tabBarController that I add by putting the following code in:
AppDelegate.h:
... UITabBarController IBOutlet *tabBarController; } @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
AppDelegate.m:
... [self.window addSubview:tabBarController.view]; [self.window makeKeyAndVisible]; [tabBarController setDelegate:self];
Then I use the following code to represent the scan view in barcode scan mode:
- (void)tabBarController:(UITabBarController *)tbc didSelectViewController:(UIViewController *)vc { // Middle tab bar item in question. if (vc == [tabBarController.viewControllers objectAtIndex:2]) { ScanVC *scanView = [[ScanVC alloc] initWithNibName:@"ScanViewController" bundle:nil]; // set properties of scanView ivars, etc UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:scanView]; [tabBarController presentModalViewController:navigationController animated:YES]; [navigationController release]; [scanView release]; } }
When it does appear, I think this method is not visually appealing, because when I reject the modal view, I return to the empty view.
Many barcode scanning applications or applications that simply display an image picker, for example; do it quite successfully. I'm just wondering what kind of implementation they will use to achieve this effect.
This is a screenshot of an application called Path, which has the same functionality as after:

I also noticed that in these applications, if you are on any other tab item other than the average, let them say, and you click on the tab bar item that represents the modal view, after it is rejected, it doesnβt actually return them to empty views, it is rejected as normal, however the actual tab bar item that represents the modal view is never selected. I would be pleased with this type of functionality if this is the only way to implement this type of effect.
Any help would be greatly appreciated as I have been stuck with this for quite some time. Also, I'm not even sure if this is the right way to put all this code in my AppDelegate so that the View controller is presented as modal. Everything seems simple, wrong.