在WPF中,我可以创建一个具有多个列定义的网格,其中单个列可以占用未使用的屏幕空间,如下所示:
<Grid Height="50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Background="Red"/>
<Grid Grid.Column="1" Background="Blue"/>
<Grid Grid.Column="2" Background="Yellow"/>
<Grid Grid.Column="3" Background="Pink"/>
<Grid Grid.Column="4" Background="Green"/>
</Grid>
我需要在iOS上复制相同的UI。我已经研究过使用UIStackView,但由于我使用iOS的经验较少,我不知道如何去做。 UIStackView是正确的选择还是需要使用其他布局?如何在iOS上复制此UI?请注意,这需要以编程方式完成。