简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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