简体   繁体   English

如何在iOS中相对于其他UI元素添加UILabel

[英]how to add UILabel relative to other UI elements in iOS

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

You should operate on frame property (eg. put label at bottom of the button): 您应该对框架属性进行操作(例如,将标签放在按钮底部):

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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM