0

I create a custom segue:

-(void)perform{

UIViewController *destination = [self destinationViewController];
UIViewController *source = [self sourceViewController];

[source.view addSubview:destination.view];

CGRect destionationFrame = destination.view.frame;
CGRect sourceFrame = source.view.frame;
CGSize sourceSize = CGSizeMake(sourceFrame.size.height, sourceFrame.size.width);

destination.view.frame = CGRectMake(sourceSize.width,0,destionationFrame.size.width,destionationFrame.size.height);

[UIView animateWithDuration:0.3
                      delay:0
                    options:UIViewAnimationCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
                 animations:^{
                     destination.view.frame = CGRectMake(sourceSize.width-destionationFrame.size.width,0,destionationFrame.size.width,destionationFrame.size.height);
                 } completion:^(BOOL finished) {
                     //[source presentModalViewController:destination animated:NO completion:nil];
                     //[source presentModalViewController:destination animated:NO];
                 }];

}

The problem is that, if i do nothing when the animation is finished, touching any controls of destination controller causes app crash.

If i make a presentModalViewController causes that any object on the screen responds.

Any help? Thanks

Fran Fox
  • 575
  • 1
  • 4
  • 5

2 Answers2

1

Since you're doing this:

[source.view addSubview:destination.view];

You first need to do this:

[source addChildViewController:destination];

Not sure if it will resolve your issues though.

Mike Pollard
  • 10,195
  • 2
  • 37
  • 46
0

You are creating the destinationViewController locally in the method, You should make the destinationView Controller (destination) as a class member so that it's scope will be there.

Amit
  • 1,043
  • 1
  • 10
  • 32