I have a custom segue where I am trying to do the reverse of the standard “Cover Vertical” segue transition. I think this should work:
UIView *srcView = ((UIViewController *)self.sourceViewController).view; UIView *dstView = ((UIViewController *)self.destinationViewController).view; [dstView setFrame:CGRectMake(0, 0, srcView.window.bounds.size.width, srcView.window.bounds.size.height)]; [srcView.window insertSubview:dstView belowSubview:srcView]; [UIView animateWithDuration:0.3 animations:^{ srcView.center = CGPointMake(srcView.center.x - srcView.frame.size.width, srcView.center.y); } completion:^(BOOL finished){ [srcView removeFromSuperview]; } ];
The problem is the destination view shows up in portrait orientation even though every other view in the app is landscape orientation. Also, the x and y coordinates are reversed. Why is this happening?
I have set up shouldAutorotateToInterfaceOrientation in every view controller, but that didn’t help. I could rotate the view with CGAffineTransformMakeRotation, but that doesn’t seem like the right thing to do; coordinates would still be reversed, for one thing.
Update:
I tried using CGAffineTransformRotate to rotate the view , but it looks ridiculous. Most of the background shows up black. I don’t think this is the way it’s suppose to work.
Apparently, it was much easier than I thought to do the segue I wanted. Here’s is what worked:
Hopefully this helps someone else.