我正在开发一个 angular 2 nativescript 应用程序。在其中一个页面上,我们有一个底部栏,最初需要出现在页面底部,当调用键盘时,它会随之向上移动(参见屏幕截图)。该栏在 Android 中正确显示,即底部栏(id:bottom-bar)随着键盘向上移动。但这种行为在 iOS 中无法正常工作。即使键盘向上滑动,该栏仍保留在页面底部。如何在 iOS 中解决此问题?
我的模板如下:
父模板:
<StackLayout>
<StackLayout sdkToggleNavButton>
<ActionBar title="Parent" backgroundColor="#f82462">
</ActionBar>
</StackLayout>
<GridLayout rows="auto, *">
<GridLayout row="0" rows="auto auto">
<StackLayout row="0" id="horizontal-tag-container">
<horizontal-tag [name]="detailItem['item']"></horizontal-tag>
</StackLayout>
<StackLayout row="1" id="segmented-bar-container">
<SegmentedBar class="m-5" #sb [items]="myItems" selectedIndex="0" (selectedIndexChange)="onChange(sb.selectedIndex)"></SegmentedBar>
</StackLayout>
</GridLayout>
<GridLayout row="1" rows="*, auto">
<!--The child template is replaced by router outlet-->
<router-outlet></router-outlet>
</GridLayout>
</GridLayout>
子模板(用于路由器插座)
<GridLayout>
<GridLayout rows="*, auto">
<StackLayout row="0" class="form">
<StackLayout class="input-field">
<TextView [(ngModel)]="textContent" class="input" hint="Write something"></TextView>
</StackLayout>
</StackLayout>
<GridLayout row="1" backgroundColor="#f82462">
<GridLayout height="50" columns="25*, 25*, 25*, 25*" backgroundColor="#f82462" id="bottom-bar">
<GridLayout col="0" (tap)="setTab(0)">
<Label class="fa fa-tab-icon" text="" [ngClass]="{'tab-selected': selected === 0}"></Label>
</GridLayout>
<GridLayout col="0" (tap)="setTab(0)">
<Label text="Back" class="tabLabel" [ngClass]="{'tab-selected': selected === 0}"></Label>
</GridLayout>
<!--<GridLayout col="1" (tap)="setTab(1)">
<Label class="fa fa-tab-icon" text="" [ngClass]="{'tab-selected': selected === 1}"></Label>
</GridLayout>
<GridLayout col="1" (tap)="setTab(1)">
<Label text="Test" class="tabLabel" [ngClass]="{'tab-selected': selected === 1}"></Label>
</GridLayout>-->
<GridLayout col="2" (tap)="setTab(2)">
<Label class="fa fa-tab-icon" text="" [ngClass]="{'tab-selected': selected === 2}"></Label>
</GridLayout>
<GridLayout col="2" (tap)="setTab(2)">
<Label text="" class="tabLabel" [ngClass]="{'tab-selected': selected === 2}"></Label>
</GridLayout>
<GridLayout col="3" (tap)="setTab(3)">
<Label class="fa fa-tab-icon" text="" [ngClass]="{'tab-selected': selected === 3 }"></Label>
</GridLayout>
<GridLayout col="3" (tap)="setTab(3)">
<Label text="Next" class="tabLabel" [ngClass]="{'tab-selected': selected === 3}"></Label>
</GridLayout>
</GridLayout>
</GridLayout>
</GridLayout>
</GridLayout>