ScrollView 总结

var length = Math.ceil(boxProducts.length / 2);

var yGap = 10;
var itemHeight = this._itemWidget.getContentSize().height;
var totalHeight = yGap * (length - 1) + itemHeight * length;
var innerSize = this._ScrollView.getInnerContainerSize();
totalHeight = Math.max(this._ScrollView.getContentSize().height, totalHeight);

var height = this._ScrollView.getContentSize().height;
if(height < totalHeight){
    this._ScrollView.setBounceEnabled(true);
}
this._ScrollView.setInnerContainerSize(cc.size(innerSize.width, totalHeight));

//x坐标起始
var xStart = 120;
//y坐标起始
// var yStart = 300;
var yStart = totalHeight - itemHeight / 2;

你可能感兴趣的:(Cocos2dx)