I am trying to animate a full-screen view sliding in from the left and using the whole space.
I have the following code which does the expected job perfectly fine on iOS 8, but fails to do so on iOS 7 :
[source.view addSubview:destination.view];
NSDictionary *viewsDict = @{@"tableView":destination.tableView,
@"tapView": destination.tapView,
@"destinationView": destination.view};
[source.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[destinationView]|" options:0 metrics:nil views:viewsDict]];
source.leftConstraint = [NSLayoutConstraint constraintWithItem:destination.tableView
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:source.view
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:-source.view.bounds.size.width];
[source.view addConstraint:source.leftConstraint];
source.rightConstraint = [NSLayoutConstraint constraintWithItem:source.view
attribute:NSLayoutAttributeTrailing
relatedBy:NSLayoutRelationEqual
toItem:destination.tapView
attribute:NSLayoutAttributeTrailing
multiplier:1.0
constant:source.view.bounds.size.width];
[source.view addConstraint:source.rightConstraint];
[source.view layoutIfNeeded];
[UIView animateWithDuration:.35f animations:^{
source.rightConstraint.constant = 0;
source.leftConstraint.constant = 0;
[source.view layoutIfNeeded];
}];
When this gets executed on iOS 7 the destination.view
gets added to the screen straight away without any animation. Any idea why that might be the case ?