引用多个 uiimageview 的变量
好吧,我想做的是我有一个带有许多 uiimageview 的应用程序,您可以移动它们并对其执行操作。我如何创建一个引用所有这些插座的变量(不是 IBOutletCollection 因为我必须使用数组,而数组没有 uiimageviews 具有的属性,而不是为每个插座创建多个插座。我尝试过,如果您确定它有效,请告诉我代码)。例如我有很多 uiimageviews,variable = 我所有的 uiimageviews
所以然后 [variable move];它移动所有的 uiimageview。 (不是位 & 或 && 运算符)
Okay so what I want to do is I have an app with many uiimageviews that you can move and do actions with them. Instead of creating many outlets for each, how can i create one variable that refers to all these outlets (not IBOutletCollection because i would have to use array and arrays dont have properties that uiimageviews do. Ive tried that if youre positive it works please show me the code). For example I have many uiimageviews, variable = all my uiimageviews
So then [variable move]; it moves all the uiimageviews. (NOT BITWISE & or && OPERATOR)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何创建所有
UIImageView
实例并将它们包装在一个透明的UIView
中。然后,当您想要移动所有 UIImageViews 时,您只需要移动它们的包装器(如 UIView 所示)。更新
此代码创建一个 uiview,其中包含 10 个 uiimageview。当您移动该视图(包装视图)时,子图像视图将随之移动。
How about creating all of the
UIImageView
instances and wrapping them in a single transparentUIView
. Then when you want to move all the UIImageViews you'd just need to move their wrapper (said UIView).update
This code creates an uiview that has 10 uiimageviews inside it. When you move that view (wrapper view) the child image views will move with it.