<commit_before>﻿import observable = require("ui/core/observable");
import view = require("ui/core/view");
import application = require("application");

export class Button extends view.View {
    private static textProperty = "text";
    private _ios: UIKit.UIButton;
    private _clickHandler: Foundation.NSObject;

    constructor() {
        super();
        this._ios = UIKit.UIButton.buttonWithType(UIKit.UIButtonType.UIButtonTypeSystem);

        var that = this;
        var target = Foundation.NSObject.extends({ click: (args) => { that.emit("click"); } }, { exposedMethods: { "click": "v@:@" } });
        this._clickHandler = new target();
        this._ios.addTargetActionForControlEvents(this._clickHandler, "click", UIKit.UIControlEvents.UIControlEventTouchUpInside);
    }

    get ios(): UIKit.UIButton {
        return this._ios;
    }

    get text(): string {
        return this.ios.titleForState(UIKit.UIControlState.UIControlStateNormal);
    }
    set text(value: string) {
        this.setProperty(Button.textProperty, value);
    }

    public setNativeProperty(data: observable.PropertyChangeData) {
        if (data.propertyName === Button.textProperty) {
            this.ios.setTitleForState(data.value, UIKit.UIControlState.UIControlStateNormal);
        } else if (true) {
            //
        }
    }
} <commit_msg>this.ios.sizeToFit() added to the iOS button<commit_after>﻿import observable = require("ui/core/observable");
import view = require("ui/core/view");
import application = require("application");

export class Button extends view.View {
    private static textProperty = "text";
    private _ios: UIKit.UIButton;
    private _clickHandler: Foundation.NSObject;

    constructor() {
        super();
        this._ios = UIKit.UIButton.buttonWithType(UIKit.UIButtonType.UIButtonTypeSystem);

        var that = this;
        var target = Foundation.NSObject.extends({ click: (args) => { that.emit("click"); } }, { exposedMethods: { "click": "v@:@" } });
        this._clickHandler = new target();
        this._ios.addTargetActionForControlEvents(this._clickHandler, "click", UIKit.UIControlEvents.UIControlEventTouchUpInside);
    }

    get ios(): UIKit.UIButton {
        return this._ios;
    }

    get text(): string {
        return this.ios.titleForState(UIKit.UIControlState.UIControlStateNormal);
    }
    set text(value: string) {
        this.setProperty(Button.textProperty, value);
    }

    public setNativeProperty(data: observable.PropertyChangeData) {
        if (data.propertyName === Button.textProperty) {
            this.ios.setTitleForState(data.value, UIKit.UIControlState.UIControlStateNormal);
            this.ios.sizeToFit();
        } else if (true) {
            //
        }
    }
} 
{'fraction_non_alphanumeric': 0.12640347700108656, 'fraction_numerical': 0.0, 'mean_word_length': 3.1285500747384156, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5770455', 'n_tokens_mistral': 804, 'n_tokens_neox': 781, 'n_words': 150}