如何添加相对于其他 UI 元素(以及自定义 View /控件)的标签?
最佳答案
您应该对框架属性进行操作(例如,将标签放在按钮底部):
CGRect buttonRect = self.myButton.frame;
buttonRect.origin.y = buttonRect.origin.y + buttonRect.size.height;
UILabel *lbl = createALabel();
lbl.frame = buttonRect;
[self.myButton.superview addSubView:lbl];
关于ios - 如何在 iOS 中添加相对于其他 UI 元素的 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5116502/