2015-02-05 112 views
0

如何在場景出現之前設置ScrollView的初始滾動偏移量?如何設置初始ScrollView偏移量?

據維基:http://www.cocos2d-x.org/reference/native-cpp/V3.3/d8/d29/classcocos2d_1_1ui_1_1_scroll_view.html

2種方法,可能做什麼我期待的不過是「jumpToPercent」和「scrollToPercent」跳到百分之似乎並沒有在所有的工作,並且即使將時間設置爲0,滾動到百分比也是動態的,這導致用戶能夠在場景開始時看到真正快速的滾動。

scrollView->scrollToPercentHorizontal(scrollToPercent, 0, false); 
// scrollView->jumpToPercentHorizontal(scrollToPercent); 
this->addChild(scrollView); 
+0

我覺得UI ::滾動型有一個錯誤在這裏。你應該調用scrollView-> jumpToPercentHorizo​​ntal(scrollToPercent);在場景的onEnter方法中。 – zilongshanren

+0

我剛剛在onEnter方法上試了一下,它完美地工作。如果您想將此作爲答案添加,請將其標記爲正確。順便說一下,通常在「onEnter」方法上放置什麼東西?如果我理解正確,這將相當於viewWillAppear的權利? – Pochi

回答

0
scrollView->setInnerContainerPosition 
相關問題