iphone - 如何将 UIButton 添加到 UIButton

标签 iphone objective-c ios ipad uibutton

如何在 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/

相关文章:

iphone - 如何确定 UITableView 何时完成加载所有行?

iphone - WhiteRaccoon 如何使用它?

objective-c - 在 iPad 6.0 模拟器中运行应用程序时出现布局问题

ios - 如何让生产签名的应用程序从 iOS 上的测试环境获取收据?

objective-c - 标签栏项目的标题不显示

ios - 在 UITableView 中滚动时如何隐藏/显示图像?

iphone sdk 3.2 到 4.0 Nib 编辑

ios - UIPickerView 作为 UITextField 的输入 View

objective-c - UILabel attributedText 和 minimumScaleFactor

ios - CLLocationManager didVisit 不工作