Add TabView.iosIconRenderingMode property

Resolves #2689
This commit is contained in:
Rossen Hristov
2016-11-04 16:18:55 +02:00
parent 350498ef7b
commit 93cc666b8f
17 changed files with 89 additions and 1 deletions

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -18,6 +18,7 @@ export function pageLoaded(args: EventData) {
examples.set("tabStyle", "tab-view/all");
examples.set("tabmore", "tab-view/tab-view-more");
examples.set("tabViewCss", "tab-view/tab-view-css");
examples.set("tab-view-icons", "tab-view/tab-view-icon");
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
page.bindingContext = viewModel;

View File

@@ -0,0 +1,14 @@
import { EventData } from "data/observable";
import { Button } from "ui/button";
import { TabView } from "ui/tab-view";
let iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
export function onChangeRenderingMode(args: EventData){
let button = (<Button>args.object);
let tabView = button.page.getViewById<TabView>("tab-view");
tabView.iosIconRenderingMode = iconModes[(iconModes.indexOf(tabView.iosIconRenderingMode) + 1) % iconModes.length];
for(let i = 0, length = tabView.items.length; i < length; i++){
(<Button>tabView.items[i].view).text = "" + tabView.iosIconRenderingMode;
}
}

View File

@@ -0,0 +1,26 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<TabView id="tab-view" tabTextColor="green" selectedTabTextColor="red" tabBackgroundColor="yellow">
<TabView.items>
<TabViewItem iconSource="res://icon">
<TabViewItem.view>
<Button text="undefined" tap="onChangeRenderingMode"/>
</TabViewItem.view>
</TabViewItem>
<TabViewItem iconSource="res://add_to_fav">
<TabViewItem.view>
<Button text="undefined" tap="onChangeRenderingMode"/>
</TabViewItem.view>
</TabViewItem>
<TabViewItem iconSource="res://icon" title="NativeScript">
<TabViewItem.view>
<Button text="undefined" tap="onChangeRenderingMode"/>
</TabViewItem.view>
</TabViewItem>
<TabViewItem iconSource="res://add_to_fav" title="Favorites">
<TabViewItem.view>
<Button text="undefined" tap="onChangeRenderingMode"/>
</TabViewItem.view>
</TabViewItem>
</TabView.items>
</TabView>
</Page>