Files
NativeScript/tests/app/ui/segmented-bar/segmented-bar-tests-native.ios.ts
Panayot Cankov 6d7c1ff295 Avoid applying CSS multiple times (#4784)
* Move the applyStyleFromScope to onLoaded, when the views are created and id or className properties are set the CSS selectors are queried and applied multiple times

* Condense the changes when applying properties
2017-09-25 18:32:00 +03:00

18 lines
917 B
TypeScript

import * as segmentedBarModule from "tns-core-modules/ui/segmented-bar";
export function getNativeItemsCount(bar: segmentedBarModule.SegmentedBar): number {
return (<UISegmentedControl>bar.nativeViewProtected).numberOfSegments;
}
export function checkNativeItemsTextColor(bar: segmentedBarModule.SegmentedBar): boolean {
var attrs = (<UISegmentedControl>bar.nativeViewProtected).titleTextAttributesForState(UIControlState.Normal);
var nativeViewColor = bar.color && attrs && attrs.valueForKey(NSForegroundColorAttributeName);
var barColor = bar.color.ios;
return barColor.isEqual(nativeViewColor);
}
export function setNativeSelectedIndex(bar: segmentedBarModule.SegmentedBar, index: number): void {
(<UISegmentedControl>bar.nativeViewProtected).selectedSegmentIndex = index;
(<UISegmentedControl>bar.nativeViewProtected).sendActionsForControlEvents(UIControlEvents.ValueChanged);
}