[英]How to change top and bottom padding of text in MaterialDesign Overlined Textfield in iOS?
[英]How do you change the top-padding for a view in iOS?
我想在切換按鈕時將視圖的頂部填充更改為80。 怎么做? 基本上,我希望視圖頂部和文本之間有80的間距。
如果使用自動布局,則最簡單的方法是為文本和視圖頂部之間的距離創建約束。 您可以將其連接到代碼中的NSLayoutConstraint,然后在按下按鈕時將constraint.constant設置為新值。
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *paddingConstraint;
// Somewhere after the button press
self.paddingConstraint.constant = 80;
哦,您可能需要調用此命令來更新布局-
[self layoutIfNeeded];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.