diff --git a/ui/layouts/layout-base.d.ts b/ui/layouts/layout-base.d.ts index f36d88968..111147ab7 100644 --- a/ui/layouts/layout-base.d.ts +++ b/ui/layouts/layout-base.d.ts @@ -45,6 +45,11 @@ */ removeChild(view: view.View); + /** + * Removes all views in this layout. + */ + removeChildren(); + /** * Gets or sets padding style property. */ diff --git a/ui/layouts/layout-base.ts b/ui/layouts/layout-base.ts index 47c0587be..c7ba48a62 100644 --- a/ui/layouts/layout-base.ts +++ b/ui/layouts/layout-base.ts @@ -56,6 +56,12 @@ export class LayoutBase extends view.CustomLayoutView implements definition.Layo this._subViews.splice(index, 1); } + public removeChildren() { + while (this.getChildrenCount() != 0) { + this.removeChild(this._subViews[this.getChildrenCount() - 1]); + } + } + public _eachChildView(callback: (child: view.View) => boolean) { var i; var length = this._subViews.length;