gpt4 book ai didi

ios - 如何在 View 中重叠 UIButton 和 UIImage?

转载 作者:行者123 更新时间:2023-11-29 02:51:55 29 4
gpt4 key购买 nike

我想像下图那样与UIImageViewUIButton重叠。

enter image description here

UIImageView在两个UIButton的后面。

如果我将 UIImageView 放在这两个 Button 后面,我如何确保 UIButton 不会被 UIImageView< 挡住 ?

提前致谢。

最佳答案

为了确保您的按钮可见并捕获事件,您可以使用 bringSubviewToFront

UIImageView *myImageView = //..alloc, init;
UIButton *button1 = //..alloc, init;
UIButton *button2 = //..alloc, init;
[self.view addSubview:myImageView];
[self.view addSubview:button1];
[self.view addSubview:button2];
[self.view bringSubviewToFront:button1];
[self.view bringSubviewToFront:button2];

关于ios - 如何在 View 中重叠 UIButton 和 UIImage?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24385624/

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