チタンで左右の矢印を使用して垂直スクロールを制御する方法。スクロールビューと左右矢印の接続方法
コードは次のとおりです。
var counter = 0;
rightArrow.addEventListener('click', function(e) {
counter++;
var wrapperChild = wrapperView.getChildren();
var scroll2 = verticalScroll.scrollTo(114, 0);
var scroll1 = verticalScroll.scrollTo(0, 0);
var scroll3 = verticalScroll.scrollTo(307, 0);
if (counter == 1) {
verticalScroll.scrollTo(114, 0);
alert(counter);
} else if (counter == 2) {
verticalScroll.scrollTo(307, 0);
alert(counter);
//}
} else if (counter == 3) {
verticalScroll.scrollTo(417, 0);
alert(counter);
} else if (counter == 4) {
verticalScroll.scrollTo(560, 0);
alert(counter);
} else if (counter == 5) {
verticalScroll.scrollTo(672, 0);
alert(counter);
}
});
leftArrow.addEventListener('click', function(e) {
if (counter == 0) verticalScroll.scrollTo(0, 0);
});
verticalScroll.addEventListener('scroll', function(e) {
Ti.API.info('Scrollview contents y offset: ' + e.x + 'Scrollview contents y offset: ' + e.y);
});