单触摸。从 ViewController 中删除特定的 UIImage SubView

发布于 2024-12-19 02:50:14 字数 242 浏览 1 评论 0原文

如何快速从 ParentViewController.View.Subviews 集合中查找并删除 UIImageView

现在我正在比较 Image.Size,但它运行缓慢并且有时会闪烁。比较 Image 对象失败。

upd...闪烁的原因原来是我搞砸的其他一些东西。我解决了这个问题。尽管如此,通过 Image.Size 进行比较似乎并不是一个好主意

How to find and remove a UIImageView from the collection of ParentViewController.View.Subviews very quick?

Right now I'm comparing the Image.Size but it works slow and sometimes flickers. Comparing Image objects fails.

upd... the reason of the flickering turned out to be some other stuff I messed up. I fixed that. Still, comparing by Image.Size doesn't seem like a very good idea

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

森林散布 2024-12-26 02:50:14

您可以尝试以下操作:

向您的 UIImageView 添加一个唯一的标记属性 (int):

myImageView.Tag = 100;

然后,使用此标记,您可以将其从超级视图中删除:

ParentViewController.View.ViewWithTag(100).RemoveFromSuperview();

You can try this :

Add a unique tag property (int) to your UIImageView:

myImageView.Tag = 100;

Then, with this tag, you can remove it from the superview:

ParentViewController.View.ViewWithTag(100).RemoveFromSuperview();

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文