diff --git a/ui/core/view.d.ts b/ui/core/view.d.ts index 1ef026def..5e26b640d 100644 --- a/ui/core/view.d.ts +++ b/ui/core/view.d.ts @@ -1,7 +1,7 @@ import proxy = require("ui/core/proxy"); export declare class View extends proxy.ProxyObject { - addToParent: (parent: any) => void; + public addToParent(parent: any); android: any; ios: any; } \ No newline at end of file diff --git a/ui/core/view.ios.ts b/ui/core/view.ios.ts index 19a76f130..75dc1b331 100644 --- a/ui/core/view.ios.ts +++ b/ui/core/view.ios.ts @@ -1 +1,11 @@ - \ No newline at end of file +import proxy = require("ui/core/proxy"); + +export class View extends proxy.ProxyObject { + public addToParent(parent: UIKit.UIView) { + var nativeInstance: UIKit.UIView = this["ios"]; + if (nativeInstance) { + // TODO: Check for existing parent + parent.addSubview(nativeInstance); + } + } +} \ No newline at end of file diff --git a/ui/label/label.ios.ts b/ui/label/label.ios.ts index 1f056b0e9..a9e998eb2 100644 --- a/ui/label/label.ios.ts +++ b/ui/label/label.ios.ts @@ -1,5 +1,50 @@ -import view = require("ui/core/view"); +import observable = require("ui/core/observable"); +import view = require("ui/core/view"); +import application = require("application"); export class Label extends view.View { + private static textProperty = "text"; + private _ios: UIKit.UILabel; + private changedHandler: Foundation.NSObject; + constructor() { + super(); + + this._ios = new UIKit.UILabel(); + + //var extendsBody = Foundation.NSObject.extends( + // { + // onTextChanged: function (path, sender, change, context) { + // } + // }, + // { + // exposedMethods: { "tick:": "v@:@" } + // }); + + //this.changedHandler = new extendsBody(); + } + + get ios(): UIKit.UILabel { + return this._ios; + } + + get text(): string { + return this._ios.text; + } + set text(value: string) { + this.setProperty(Label.textProperty, value); + } + + public setNativeProperty(data: observable.PropertyChangeData) { + // TODO: Will this be a gigantic if-else switch? + if (data.propertyName === Label.textProperty) { + this._ios.text = data.value; + } else if (true) { + } + } + + public addToParent(parent: UIKit.UIView) { + super.addToParent(parent); + this._ios.sizeToFit(); + } } \ No newline at end of file