我在iOS上制作照片拼贴应用程序。 照片的最大数量为12.拍摄照片后,我将它们以网格方式排列在不同的帧中(如PicCollage中)。
现在我想添加一个功能,用户可以通过该功能操作帧的边缘。 它们可以一次触摸并使任何特定的图像视图变大或变小(类似于SplitPic中使用的概念)。 我不知道该怎么做。 我可以手动保持跟踪帧的所有边缘,然后在触摸移动中递增/递减x,y,宽度,高度,但这是正确的方法吗?
I am making a photo collage app in iOS. The maximum number of photos is 12. After taking the photos I am arranging them in different frames in a grid fashion (like in PicCollage).
Now I want to add a feature by which the user can manipulate the edges of the frames. They can touch and make any particular imageview bigger or smaller one at a time (similar to the concept used in SplitPic). I am getting no idea about how to do this. I can manually keep a track of all the edges of the frames and then increment / decrement the x, y, width, height incrementally in touch move but is this the right approach ?
最满意答案
使用附加到每个UIImageViews的UIPanGestureRecognizer,并在其方法中进行必要的框架更改。 网上有很多关于此的教程。
您不需要“手动跟踪帧” - 只要它们显示在屏幕上(附加到显示的某个超级视图),它们将保留这些值以供您检查/修改。
Use a UIPanGestureRecognizer attached to each of your UIImageViews and do the necessary frame changes in it's methods. There's a ton of tutorials on the web for this.
You don't need to "manually keep track of the frames" - as long as they're displayed on screen (attached to some superview that is displayed), they will keep those values for you to inspect/modify.
更多推荐
发布评论