mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #371 from NativeScript/issue-343
Resolved issue #343.
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import placeholder = require("ui/placeholder");
|
import placeholder = require("ui/placeholder");
|
||||||
|
|
||||||
export function creatingView(args: placeholder.CreateViewEventData) {
|
export function creatingView(args: placeholder.CreateViewEventData) {
|
||||||
var nativeView = new android.widget.LabelView(args.context);
|
var nativeView = new android.widget.TextView(args.context);
|
||||||
nativeView.setText("Native");
|
nativeView.setText("Native");
|
||||||
args.view = nativeView;
|
args.view = nativeView;
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<Page xmlns="http://www.nativescript.org/tns.xsd">
|
<Page xmlns="http://www.nativescript.org/tns.xsd">
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<Placeholder creatingView="creatingView"/>
|
<Placeholder creatingView="creatingView" width="200" height="200" backgroundColor="red"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</Page>
|
</Page>
|
@ -11,7 +11,7 @@ export class Placeholder extends common.Placeholder {
|
|||||||
public _createUI() {
|
public _createUI() {
|
||||||
var args = <definition.CreateViewEventData>{ eventName: common.Placeholder.creatingViewEvent, object: this, view: undefined, context: this._context };
|
var args = <definition.CreateViewEventData>{ eventName: common.Placeholder.creatingViewEvent, object: this, view: undefined, context: this._context };
|
||||||
this.notify(args);
|
this.notify(args);
|
||||||
this._android = <android.view.View>args.view;
|
this._android = <android.view.View>args.view || new android.view.View(this._context);
|
||||||
}
|
}
|
||||||
|
|
||||||
get android(): android.view.View {
|
get android(): android.view.View {
|
||||||
|
@ -10,10 +10,9 @@ export class Placeholder extends common.Placeholder {
|
|||||||
|
|
||||||
get ios(): UIView {
|
get ios(): UIView {
|
||||||
if (!this._ios) {
|
if (!this._ios) {
|
||||||
console.trace();
|
|
||||||
var args = <definition.CreateViewEventData>{ eventName: common.Placeholder.creatingViewEvent, object: this, view: undefined, context: undefined };
|
var args = <definition.CreateViewEventData>{ eventName: common.Placeholder.creatingViewEvent, object: this, view: undefined, context: undefined };
|
||||||
super.notify(args);
|
super.notify(args);
|
||||||
this._ios = args.view;
|
this._ios = args.view || new UIView();
|
||||||
}
|
}
|
||||||
return this._ios;
|
return this._ios;
|
||||||
}
|
}
|
||||||
@ -21,5 +20,4 @@ export class Placeholder extends common.Placeholder {
|
|||||||
get _nativeView(): UIView {
|
get _nativeView(): UIView {
|
||||||
return this.ios;
|
return this.ios;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user