mirror of
https://github.com/wnagrodzki/NGModalPresentation.git
synced 2025-04-08 21:42:17 +02:00
Uses autoresizing mask to layout presentation view controller view to work around a bug during device rotation on iOS 7.
This commit is contained in:
parent
32c49e60e7
commit
5ac9d9ee78
1 changed files with 3 additions and 19 deletions
|
@ -64,26 +64,10 @@ static NSTimeInterval const kTransitionDuration = 2;
|
|||
// add toView into the view hierarchy when presenting
|
||||
if (self.mode == NGModalAnimationControllerModePresentation)
|
||||
{
|
||||
// using constraints instead coused a bug during device rotation on iOS 7
|
||||
toView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
toView.frame = containerView.bounds;
|
||||
[containerView addSubview:toView];
|
||||
|
||||
toView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
NSDictionary * views = NSDictionaryOfVariableBindings(toView);
|
||||
[containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[toView]|" options:0 metrics:nil views:views]];
|
||||
[containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[toView]|" options:0 metrics:nil views:views]];
|
||||
|
||||
NSLog(@"CSModalAnimationControllerModePresentation");
|
||||
NSLog(@"fromView initial frame %@", NSStringFromCGRect([transitionContext initialFrameForViewController:fromViewController]));
|
||||
NSLog(@"fromView final frame %@", NSStringFromCGRect([transitionContext finalFrameForViewController:fromViewController]));
|
||||
NSLog(@"toView initial frame %@", NSStringFromCGRect([transitionContext initialFrameForViewController:toViewController]));
|
||||
NSLog(@"toView final frame %@", NSStringFromCGRect([transitionContext finalFrameForViewController:toViewController]));
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"NGModalAnimationControllerModeDismissal");
|
||||
NSLog(@"fromView initial frame %@", NSStringFromCGRect([transitionContext initialFrameForViewController:fromViewController]));
|
||||
NSLog(@"fromView final frame %@", NSStringFromCGRect([transitionContext finalFrameForViewController:fromViewController]));
|
||||
NSLog(@"toView initial frame %@", NSStringFromCGRect([transitionContext initialFrameForViewController:toViewController]));
|
||||
NSLog(@"toView final frame %@", NSStringFromCGRect([transitionContext finalFrameForViewController:toViewController]));
|
||||
}
|
||||
|
||||
// find the presented view controller's view
|
||||
|
|
Loading…
Add table
Reference in a new issue