|
|
@ -274,14 +274,19 @@
|
|
|
|
presentViewController:self
|
|
|
|
presentViewController:self
|
|
|
|
animated:NO
|
|
|
|
animated:NO
|
|
|
|
completion:^{
|
|
|
|
completion:^{
|
|
|
|
[UIView animateWithDuration:0.4f
|
|
|
|
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
|
|
|
|
|
|
|
self.imageView.frame = [self.view convertRect:self.originRect
|
|
|
|
|
|
|
|
fromView:window];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[UIView animateWithDuration:0.25f
|
|
|
|
delay:0
|
|
|
|
delay:0
|
|
|
|
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
|
|
|
|
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseOut
|
|
|
|
animations:^() {
|
|
|
|
animations:^() {
|
|
|
|
self.view.alpha = 1.0f;
|
|
|
|
self.view.alpha = 1.0f;
|
|
|
|
self.imageView.frame = [self resizedFrameForImageView:self.image.size];
|
|
|
|
self.imageView.frame = [self resizedFrameForImageView:self.image.size];
|
|
|
|
self.imageView.center =
|
|
|
|
self.imageView.center =
|
|
|
|
CGPointMake(self.view.bounds.size.width / 2.0f, self.view.bounds.size.height / 2.0f);
|
|
|
|
CGPointMake(self.view.bounds.size.width / 2.0f,
|
|
|
|
|
|
|
|
self.view.bounds.size.height / 2.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
completion:^(BOOL completed) {
|
|
|
|
completion:^(BOOL completed) {
|
|
|
|
self.scrollView.frame = self.view.bounds;
|
|
|
|
self.scrollView.frame = self.view.bounds;
|
|
|
@ -296,9 +301,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (void)dismiss {
|
|
|
|
- (void)dismiss {
|
|
|
|
self.view.userInteractionEnabled = NO;
|
|
|
|
self.view.userInteractionEnabled = NO;
|
|
|
|
[UIView animateWithDuration:0.4f
|
|
|
|
[UIView animateWithDuration:0.25f
|
|
|
|
delay:0
|
|
|
|
delay:0
|
|
|
|
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
|
|
|
|
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear
|
|
|
|
animations:^() {
|
|
|
|
animations:^() {
|
|
|
|
self.backgroundView.backgroundColor = [UIColor clearColor];
|
|
|
|
self.backgroundView.backgroundColor = [UIColor clearColor];
|
|
|
|
self.scrollView.alpha = 0;
|
|
|
|
self.scrollView.alpha = 0;
|
|
|
@ -315,7 +320,6 @@
|
|
|
|
[self updateLayouts];
|
|
|
|
[self updateLayouts];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)updateLayouts {
|
|
|
|
- (void)updateLayouts {
|
|
|
|
if (_isPresenting) {
|
|
|
|
if (_isPresenting) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -327,7 +331,6 @@
|
|
|
|
self.scrollView.contentInset = [self contentInsetForScrollView:self.scrollView.zoomScale];
|
|
|
|
self.scrollView.contentInset = [self contentInsetForScrollView:self.scrollView.zoomScale];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Resizing
|
|
|
|
#pragma mark - Resizing
|
|
|
|
|
|
|
|
|
|
|
|
- (CGRect)resizedFrameForImageView:(CGSize)imageSize {
|
|
|
|
- (CGRect)resizedFrameForImageView:(CGSize)imageSize {
|
|
|
|