gpt4 book ai didi

iphone - 以编程方式在 UIImage 和 UILabel 之间添加图像

转载 作者:行者123 更新时间:2023-11-29 04:24:37 24 4
gpt4 key购买 nike

我有一个 UIImage ,我应该在其上面以编程方式添加另一个 UIImage ,上面会有一个 UILabel 。我成功添加了图像,但它与标签重叠。

如果 1. 背景图像 2. 以编程方式添加的图像 3. 标签,

那么我想要的顺序是,1个2个3

我得到的是

132

2 与我的标签重叠。我尝试过 Send to Back、Bring to Front 和 bringSubviewToFront。它不起作用。

最佳答案

UIImageView *img2=[[UIImageView alloc] initWithImage: [UIImage imageNamed: @"TDK 3 Speaker.png"]];
//img2.backgroundColor=[UIColor clearColor];
[BgImage addSubview:img2];
UILabel *lblText=[[UILabel alloc]initWithFrame:CGRectMake(200, 0, 200, 40)];
lblText.text=@"I am Here";
//lblText.backgroundColor=[UIColor clearColor];
[BgImage addSubview:lblText];

关于iphone - 以编程方式在 UIImage 和 UILabel 之间添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12506184/

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