From 50e0464f1b5f9363a21e8fb44ba97881231f4362 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Fri, 13 Jun 2014 14:09:27 +0300 Subject: [PATCH] button implementation for iOS fixed --- ui/button/button.ios.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/button/button.ios.ts b/ui/button/button.ios.ts index 63d600e7e..fe4f8868b 100644 --- a/ui/button/button.ios.ts +++ b/ui/button/button.ios.ts @@ -5,14 +5,16 @@ 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.UIButtonTypeRoundedRect); + 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._ios.addTargetActionForControlEvents(new target(), "click:", UIKit.UIControlEvents.UIControlEventTouchUpInside); + 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 {