简体   繁体   English

如何将多个imageview分组以具有1个滑动手势识别器? iOS Swift

[英]How to group multiple imageview to have 1 swipe gesture recognizer? IOS Swift

could anyone help me? 谁能帮我吗? I have this view with 5 UIImageView. 我有5 UIImageView这个视图。

在此处输入图片说明

the default image in this 5 UIImageView is the black star I have attached tap and long press gesture recogniser to this 5 UIImageView 这5个UIImageView中的默认图像是black star我已将水龙头和长按手势识别器附加到这5个UIImageView

so in this case i tap the 3rd image then the other image behind them change to red star 所以在这种情况下,我点击第三张图片,然后它们后面的其他图片变成红色星号

it is like the normal rating scenario. 就像正常的评级方案一样。

my question is how can I implement swipe gesture recogniser to this 5 UIImageView ? 我的问题是如何对这5个UIImageView实现滑动手势识别器?

can I group this 5 image into one and make 1 swipe gesture recogniser? 我可以将这5张图片组合为一张,然后做1个滑动手势识别器吗? is that possible? 那可能吗?

could anyone help me how things like this get done? 谁能帮我完成这样的事情? I appreciate anyones help. 我感谢任何人的帮助。 thanks in advance! 提前致谢!

UPDATE: I finished the tap and long press gesture and its working fine. 更新:我完成了水龙头和长按手势,它的工作正常。 The only thing left to do is to add swipe. 剩下要做的唯一一件事就是添加滑动。

I would use one image containing only the five stars and one squared image with red star and trasparent background color. 我将使用一张仅包含五颗星星的图像和一张带有红色星星和透明背景色的正方形图像。 Every time the user tap or swipe you can know wich stars is tapped using the location of the tap. 每次用户轻击或滑动,您都可以知道使用轻击的位置轻击了星星。 Then according to which star has been pressed you place, n times ,the squared image with red star on top of the image containing the five black stars. 然后,根据您按了哪颗星,您将n次放置在包含五个黑星的图像上方的带有红色星的正方形图像n次。

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

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