From e79fd51ce496ce107ab674ee21e032f917108541 Mon Sep 17 00:00:00 2001 From: Matt Donovan Date: Sat, 6 Jun 2015 14:11:00 -0500 Subject: [PATCH] adding removeChildren() for layout and fixing comment typos --- ui/layouts/layout-base.d.ts | 5 +++++ ui/layouts/layout-base.ts | 6 ++++++ 2 files changed, 11 insertions(+) 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;