Position a UIView relative to the bottom of the parent view?

前端 未结 3 632
我寻月下人不归
我寻月下人不归 2020-12-09 05:28

How can I align a UIView to the bottom of the parent so that the Y coordinate of the frame is relative to the bottom of the screen instead of the top?

This would be

相关标签:
3条回答
  • 2020-12-09 05:46

    This should do the trick

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        bottomButton.Alignment = UIStackViewAlignment.Bottom;          
    }
    
    0 讨论(0)
  • 2020-12-09 05:49

    You can set the autoresizing mask values on the Sizing pane in XIB or Storyboard editor.

    0 讨论(0)
  • 2020-12-09 05:50

    Once you have initially positioned the view by setting its frame property, adjust its autoresizingMask to include UIViewAutoresizingFlexibleTopMargin. That will keep it anchored to the bottom of its superview.

    0 讨论(0)
提交回复
热议问题