如何相对于其他UI元素(以及自定义视图/控件)添加标签?

最佳答案

您应该对框架属性进行操作(例如,将标签放在按钮底部):

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/

10-10 20:53