gpt4 book ai didi

ios - 将程序化的 UIView 发送到 Storyboard 中添加的 UIView

转载 作者:行者123 更新时间:2023-11-29 01:19:43 25 4
gpt4 key购买 nike

我正在以编程方式创建 UIView 并调用此 UIView captureImage。此 UIView captureImage 显示我从相机和我称之为 self.frameForCapture 的 parentView 捕获的图像。但问题是,它总是与我添加到 Storyboard 中的 UIView 重叠。

更新帖子:

这是我试图在我的应用程序中制作的图像。 enter image description here

Black View 是我的 parentView,我称它为 self.frameForCapture。Blue View 是 childView,我使用 Storyboard添加它。Red View 是 childView,我以编程方式添加到 parentView。但是我把它添加到 redView 的时候。它总是与 blueView 重叠,我使用这个 addSubView:。但是如果我用这些

[self.frameForCapture bringSubviewToFront:captureImage]; 
[self.frameForCapture sendSubviewToBack:captureImage];

什么都没发生。我使用了这段代码:

self.newalbumImageView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.newalbumImageView setContentMode:UIViewContentModeScaleAspectFill];
self.newalbumImageView.image = self.albumImage;
UIView * captureImage = [[UIView alloc] initWithFrame:self.frameForCapture.frame];
[captureImage addSubview:self.newalbumImageView];
[self.frameForCapture addSubview:captureImage];

最佳答案

有几件事可以帮助你看这个问题How to make a UIView always appear at the front?只需将 headerview 链接到 .h 文件并使用 myAlwaysOnTopView.layer.zPosition = MAXFLOAT;另一件事是当你使用 [self.frameForCapture sendSubviewToBack:captureImage];redview 仍然会在 self.frameForCapture 之上,如果你不想那样你可以隐藏它甚至删除它如果您仍然遇到此问题,请标记我

关于ios - 将程序化的 UIView 发送到 Storyboard 中添加的 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34762054/

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