gpt4 book ai didi

ios - 在一个 UIImageView 中分组多个 UIImageView

转载 作者:行者123 更新时间:2023-11-28 19:13:04 27 4
gpt4 key购买 nike

我想知道是否可以将更多的 UIImageView 分组到一个 ImageView 中。例如,如果我有 4 个 imageView,并且我想以完全相同的方式为它们制作动画,我可以将它们组合成一个,然后为单个图像制作动画吗?

最佳答案

为什么不将多个 UIImageView 组合成一个 UIView?如果整个想法是同时显示多个 UIImage,我认为将它们绘制到一个容器中没有任何优势。

这是一个例子:

UIImageView *iv1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img1"]];
UIImageView *iv2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img1"]];
UIView *mainView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, iv1.frame.size.width + iv2.frame.size.width, MAX(iv1.frame.size.height,iv2.frame.size.height))];
[mainView addSubview:iv1];
iv2.frame = CGRectMake(iv1.frame.size.width, 0.0f, iv2.frame.size.width, iv2.frame.size.height);
[mainView addSubview:iv2];

关于ios - 在一个 UIImageView 中分组多个 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14006167/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com