gpt4 book ai didi

iphone - 如何将 UIButton 添加到 UIButton

转载 作者:行者123 更新时间:2023-11-28 22:43:17 27 4
gpt4 key购买 nike

如何在 UIButton 之上添加 UIButton?

这样一来,如果我移动父 UIButton,顶部的 UIButton 也会移动。

最佳答案

UIButton *testButton = [UIButton buttonWithType:UIButtonTypeCustom];
testButton.backgroundColor = [UIColor redColor];

UIButton *smallerButton = [UIButton buttonWithType:UIButtonTypeCustom];
smallerButton.backgroundColor = [UIColor greenColor];
[testButton addSubview:smallerButton];

[self.view addSubview:testButton];

关于iphone - 如何将 UIButton 添加到 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13878980/

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