I currently have three view controllers going on in my iPhone application at the same time.
I use a slidingView.
Here is my image:
When I tap on a table view cell, I want to open a new view controller like this:
(the egg is representing a new view controller.
But as you can see my orange view controller is in front.
How do I change this?
The code I use to open the egg-viewcontroller
:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIViewController *boxView = [self.storyboard instantiateViewControllerWithIdentifier:@"BoxView"];
boxView.modalPresentationStyle = UIModalPresentationFormSheet;
boxView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
boxView.view.frame=CGRectMake(-50, 5, 300, 470);
[self.view addSubview:boxView.view];
//[self.view bringSubviewToFront:boxView];
}
It should be quite easy, you need your parent view controller (i.e. the orange controller ) to add the subview of your new view controller. You could normally do that by [self.parentViewController addSubview:boxView.view]
. But since you are using ECSlidingViewController , you could do it like this:
[self.slidingViewController.topViewController.view addSubview:boxView.view]
.
Of course then you will need to adjust your new ViewController's frame accordingly.