ImageView 以编程方式发送到后台

发布于 2024-12-01 17:37:31 字数 735 浏览 1 评论 0原文

在尝试了上一篇文章中的所有方法后,我我无法成功将我的 ImageView 发送回我的示波器。我在我的示例中使用 Apple 示例的 aurioTouch 示例应用程序,我刚刚调整了其中的图像大小。现在我想在同一视图中显示另一张图像。在我的 applicationDidFinishLaunching 开头,我在写了

UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage.png"]];
[imgView setFrame:CGRectMake(0,25,320,150)];
[view addSubview:imgView];

这么多代码之后编写了下面的代码,我尝试了上一篇文章中给出的所有方法,但无法在原始图像后面获取此 newssmage..

这里 < code>view 是从 UIView 继承的类之一。我如何将新图像发送回原始图像???

After trying all the methods in the previous post I am not able to succeed sending my ImageView back to my Oscilloscope. I am using aurioTouch sample of Apple's example in my app and I have just resized the image in that.. Now I want to have another image in the same view. In my applicationDidFinishLaunching in the beginning I am writing the below code

UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage.png"]];
[imgView setFrame:CGRectMake(0,25,320,150)];
[view addSubview:imgView];

after this much of code i tried all the methods that is given in previous post but not able to get this newssmage behind the original image..

Here view is one of the class inherited from UIView.. How can I send new image back to my original image???

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

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

发布评论

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

评论(2

揽清风入怀 2024-12-08 17:37:31

看一下 UIView 的文档,您就会看到一系列影响视图层次结构的可能方法。其中一些是:

– bringSubviewToFront:
– sendSubviewToBack:
– removeFromSuperview
– insertSubview:atIndex:
– insertSubview:aboveSubview:
– insertSubview:belowSubview:
– exchangeSubviewAtIndex:withSubviewAtIndex:

One look at the documentation for UIView would give you a list of possible methods to influence the view hierarchy. Some of them are:

– bringSubviewToFront:
– sendSubviewToBack:
– removeFromSuperview
– insertSubview:atIndex:
– insertSubview:aboveSubview:
– insertSubview:belowSubview:
– exchangeSubviewAtIndex:withSubviewAtIndex:
独守阴晴ぅ圆缺 2024-12-08 17:37:31

您需要

- (void)sendSubviewToBack:(UIView *)view

像这样在代码中调用视图对象

[view sendSubviewToBack: imgView];

编辑:

我已经看到了代码,从它的外观来看,图像“Oscillscope.png”被添加到带有变量名称的EAGLView对象上view 如果我是正确的,那么您也使用相同的变量来添加您的 imgView,所以我认为它应该可以工作。

you need to call

- (void)sendSubviewToBack:(UIView *)view

on the view object in your code like this

[view sendSubviewToBack: imgView];

EDIT:

I have seen the code and from the looks of it the the image "Oscilloscope.png" is added on the EAGLView object with variable name view and if I am correct the you are using the same variable to add your imgView too, so I think it should work.

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