From ab803b9a93fe19028a6cd3eb5c9bb2d69fd1be9a Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 31 Oct 2017 16:55:49 +0800 Subject: [PATCH] fix pageview bug for fireball/issues/6557 --- cocos2d/core/components/CCPageView.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cocos2d/core/components/CCPageView.js b/cocos2d/core/components/CCPageView.js index d80e44a1ba..79700f450f 100644 --- a/cocos2d/core/components/CCPageView.js +++ b/cocos2d/core/components/CCPageView.js @@ -417,11 +417,6 @@ var PageView = cc.Class({ _updatePageView: function () { var pageCount = this._pages.length; - // 当页面数组变化时修改 content 大小 - var layout = this.content.getComponent(cc.Layout); - if(layout && layout.enabled) { - layout.updateLayout(); - } if (this._curPageIdx >= pageCount) { this._curPageIdx = pageCount === 0 ? 0 : pageCount - 1; this._lastPageIdx = this._curPageIdx; @@ -436,6 +431,13 @@ var PageView = cc.Class({ this._scrollCenterOffsetY[i] = Math.abs(this.content.y + this._pages[i].y); } } + + // 当页面数组变化时修改 content 大小 + var layout = this.content.getComponent(cc.Layout); + if (layout && layout.enabled) { + layout.updateLayout(); + } + // 刷新 indicator 信息与状态 if (this.indicator) { this.indicator._refresh();