[英]how to add UILabel relative to other UI elements in iOS
如何相對於其他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];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.