Question

I currently have three view controllers going on in my iPhone application at the same time.
I use a slidingView.

Here is my image:

enter image description here

When I tap on a table view cell, I want to open a new view controller like this:

enter image description here

(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];

}
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top