如何将图像缩放到全屏模式?

Llo*_*d18 1 iphone animation objective-c zooming ios

我有UIScrollView图像分页.我想在一些手势上实现图像的动画缩放到全屏.另一个动画将图像缩放回滚动视图.就像在iPad上的照片应用程序或Safari中的视频一样.

当然它不会是UIImageView.它将是一些包含图像的包装类.主要问题是如何呈现全屏视图.是否必须是模态视图.

任何帮助表示赞赏.

Ani*_*ari 6

检查触摸图像是否小,转换为完整尺寸.如果是大转换成小尺寸.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    if (isLarge) [self makeSmall];
    else [self makeFull];
}

- (void)makeFull {
    [[self superview] bringSubviewToFront:self];
    isLarge = YES;
    CGRect largeFrame = [self superview].bounds;
    original = self.frame;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    [self setFrame:largeFrame];
    [internal setFrame:self.bounds];
    [UIView commitAnimations];

}
- (void)makeSmall {
    isLarge = NO;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    [self setFrame:original];
    [internal setFrame:self.bounds];
    [UIView commitAnimations];

}
Run Code Online (Sandbox Code Playgroud)