@@ -30,7 +30,6 @@ export class CheckBox extends Button implements CheckBoxInterface {
3030 private _animationDuration : number ;
3131 private _onAnimationType : number ;
3232 private _offAnimationType : number ;
33- private _checkBoxSize : number ;
3433
3534 constructor ( ) {
3635 super ( ) ;
@@ -42,9 +41,8 @@ export class CheckBox extends Button implements CheckBoxInterface {
4241 this . _tintColor = "#0075ff" ;
4342 this . _onAnimationType = 2 ;
4443 this . _offAnimationType = 2 ;
45- this . _checkBoxSize = 21 ;
46-
47- this . _iosCheckbox = < BEMCheckBox > BEMCheckBox . alloc ( ) . initWithFrame ( CGRectMake ( 0 , 0 , this . _checkBoxSize , this . _checkBoxSize ) ) ;
44+
45+ this . _iosCheckbox = < BEMCheckBox > BEMCheckBox . alloc ( ) . initWithFrame ( CGRectMake ( 0 , 0 , 21 , 21 ) ) ;
4846 this . _delegate = BEMCheckBoxDelegateImpl . initWithOwner ( new WeakRef ( this ) ) ;
4947 }
5048
@@ -65,14 +63,6 @@ export class CheckBox extends Button implements CheckBoxInterface {
6563 this . _iosCheckbox . onTintColor = new Color ( color ) . ios ;
6664 }
6765
68- get checkboxSize ( ) {
69- return this . _checkBoxSize ;
70- }
71-
72- set checkBoxSize ( size : number ) {
73- this . _checkBoxSize = size ;
74- }
75-
7666 /* NATIVE PROPERTIES */
7767 set checkedAnimated ( value : boolean ) {
7868 if ( this . _iosCheckbox )
@@ -152,10 +142,14 @@ export class CheckBox extends Button implements CheckBoxInterface {
152142 public onLoaded ( ) {
153143 super . onLoaded ( ) ;
154144
145+ var fontSize = this . style . fontSize ;
155146 this . _iosCheckbox . delegate = this . _delegate ;
156- this . _iosCheckbox . frame = CGRectMake ( 0 , 0 , this . _checkBoxSize , this . _checkBoxSize ) ;
157147
158- this . style . paddingLeft = this . _checkBoxSize + 10 ;
148+ //Positioning
149+ this . _iosCheckbox . frame = CGRectMake ( 0 , 0 , fontSize , fontSize ) ;
150+ this . _iosCheckbox . center = CGPointMake ( this . _iosCheckbox . center . x , ( fontSize / 2 ) + 3 ) ;
151+
152+ this . style . paddingLeft = fontSize + ( fontSize > 20 ? 10 : 5 ) ;
159153 this . style . textAlignment = "left" ;
160154
161155 this . ios . addSubview ( this . _iosCheckbox ) ;
@@ -229,7 +223,7 @@ export class CheckBox extends Button implements CheckBoxInterface {
229223 }
230224
231225 public _onCheckedPropertyChanged ( data : PropertyChangeData ) {
232- console . log ( "_onCheckedPropertyChanged" ) ;
226+ console . log ( "_onCheckedPropertyChanged to " + data . newValue ) ;
233227 debugger ;
234228 if ( this . _iosCheckbox ) {
235229 this . _iosCheckbox . setOnAnimated ( data . newValue , true ) ;
@@ -238,7 +232,7 @@ export class CheckBox extends Button implements CheckBoxInterface {
238232}
239233
240234function onCheckedPropertyChanged ( data : PropertyChangeData ) {
241- console . log ( "onCheckedPropertyChanged" ) ;
235+ console . log ( "onCheckedPropertyChanged to " + data . newValue ) ;
242236 debugger ;
243237 var checkbox = < CheckBox > data . object ;
244238 checkbox . _onCheckedPropertyChanged ( data ) ;
@@ -268,10 +262,9 @@ class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
268262 }
269263
270264 public didTapCheckBox ( checkBox : BEMCheckBox ) : void {
271- debugger ;
272- console . log ( "delegate check" ) ;
273265 let owner = this . _owner . get ( ) ;
274266 if ( owner ) {
267+ console . log ( "delegate check " + checkBox . on ) ;
275268 owner . _onPropertyChangedFromNative ( CheckBox . checkedProperty , checkBox . on ) ;
276269 }
277270 }
0 commit comments