mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00
styler for ios added
This commit is contained in:
@ -466,6 +466,29 @@ export class TextViewStyler implements definition.stylers.Styler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SegmentedBarStyler implements definition.stylers.Styler {
|
||||||
|
//Text color methods
|
||||||
|
private static setColorProperty(view: view.View, newValue: any) {
|
||||||
|
var bar = <UISegmentedControl>view.ios;
|
||||||
|
var attrs = NSMutableDictionary.new();
|
||||||
|
attrs.setValueForKey(newValue, NSForegroundColorAttributeName);
|
||||||
|
bar.setTitleTextAttributesForState(attrs, UIControlState.UIControlStateNormal);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static resetColorProperty(view: view.View, nativeValue: any) {
|
||||||
|
var bar = <UISegmentedControl>view.ios;
|
||||||
|
var attrs = NSMutableDictionary.new();
|
||||||
|
attrs.setValueForKey(nativeValue, NSForegroundColorAttributeName);
|
||||||
|
bar.setTitleTextAttributesForState(attrs, UIControlState.UIControlStateNormal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static registerHandlers() {
|
||||||
|
style.registerHandler(style.colorProperty, new stylersCommon.StylePropertyChangedHandler(
|
||||||
|
SegmentedBarStyler.setColorProperty,
|
||||||
|
SegmentedBarStyler.resetColorProperty), "SegmentedBar");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function _registerDefaultStylers() {
|
export function _registerDefaultStylers() {
|
||||||
style.registerNoStylingClass("Frame");
|
style.registerNoStylingClass("Frame");
|
||||||
DefaultStyler.registerHandlers();
|
DefaultStyler.registerHandlers();
|
||||||
@ -473,4 +496,5 @@ export function _registerDefaultStylers() {
|
|||||||
LabelStyler.registerHandlers();
|
LabelStyler.registerHandlers();
|
||||||
TextFieldStyler.registerHandlers();
|
TextFieldStyler.registerHandlers();
|
||||||
TextViewStyler.registerHandlers();
|
TextViewStyler.registerHandlers();
|
||||||
|
SegmentedBarStyler.registerHandlers();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user