I have a StackView (Card View) with vertical orientation, alignment and distribution are "Fill".
Inside that I have a few more StackViews with horizontal orientation and a few other controls. In that, the last StackView with Horizontal Orientation, Alignment = Top and Distribution = Fill, has two buttons for "Save" and "Cancel"
XML for last stackview:
<stackView opaque="NO" contentMode="right" alignment="top" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="qk0-Aa-LVy">
<rect key="frame" x="0.0" y="301" width="414" height="51"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="wordWrap" translatesAutoresizingMaskIntoConstraints="NO" id="TzA-jj-KRx">
<rect key="frame" x="0.0" y="0.0" width="199.66666666666666" height="31"/>
<inset key="contentEdgeInsets" minX="10" minY="10" maxX="10" maxY="10"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Save" buttonSize="medium"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xHU-No-XcV">
<rect key="frame" x="214.66666666666663" y="0.0" width="199.33333333333337" height="31"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Cancel"/>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="TzA-jj-KRx" secondAttribute="bottom" constant="20" id="d5Z-DX-Keg"/>
</constraints>
I want the two buttons to right align and I don't know how to get that. I use Xamarin.iOS.
Please note, There may be some unwanted constrains and other code as this was my first learning project. Please let me know more lines from xml is needed. Thanks in advance.



First tip: Change the default names of your UI elements to make it easy to understand the Hierarchy in the Document Outline pane.
It looks like you have a lot of unnecessary constraints...
I laid out a controller to match yours (well, at least close) - here's how it looks:
The horizontal stack view containing the Save/Cancel buttons is an arranged subview of
Card Stack View... which hasAlignment: Fillwhich means theButtons Stack Viewwill be stretched to the full width.If you want the buttons to "right align" you need to embed
Buttons Stack Viewin aUIView- I'll name itBtnStack Holder View- and constrainButtons Stack ViewTop, Bottom & Trailing (but not Leading).That gives us this (I gave
BtnStack Holder Viewa Yellow background to make it easy to see):Here is the source for that Storyboard: