简体   繁体   English

点击带有动画的小图像时加载大图像

[英]Load larger image on tap of small image with animation

I'm trying to load a large version of an image in the centre of the user's screen when then tap on a smaller version of the image that's already on my view. 我试图在用户屏幕的中央加载较大版本的图像,然后点击我视图中已经存在的较小版本的图像。

Ideally I want to do this using an animation to get to the new image like a vertical flip. 理想情况下,我想使用动画来完成此操作,例如垂直翻转。

Also if there's a way to make the background look greyed out like it's not the foreground then that would be even better. 另外,如果有一种方法可以使背景看起来像不是前台一样呈灰色,那会更好。

Here's an image of what I'm after, I'm at work at the moment so haven't got access to the actual code / images. 这是我所追求的图像,此刻我正在工作,因此无法访问实际的代码/图像。

I'm a new user so can't add pictures. 我是新用户,所以无法添加图片。 Click here if you want to see what I'm thinking. 如果您想了解我的想法,请单击此处。 Image 图片

There is an KGmodal Example Exist in GitHUB hope that Might Help you. GitHUB中存在一个KGmodal示例,希望对您有所帮助。

You have to Change the content view and Add an Imageview Programatically (with required size ) in the content View. 您必须更改内容视图,并在内容视图中以编程方式(具有所需的大小)添加Imageview

Follow the below link: https://github.com/kgn/KGModal 请点击以下链接: https : //github.com/kgn/KGModal

For Fliping the image see the tutorial iphone Flip Image. 有关翻转图像,请参阅教程iphone翻转图像。

In the end I added the larger image on to begin with and set its alpha to 0, then added a gesture recognizer on the smaller image that animated the larger one and gradually changed its alpha to 1. The did the reverse on the large image. 最后,我首先添加了较大的图像,并将其alpha设置为0,然后在较小的图像上添加了一个手势识别器,该手势识别器为较大的图像设置了动画,并逐渐将其alpha更改为1。 Don't know why I didn't think of that in the first place! 不知道为什么我首先没有想到这一点!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM