Created
January 13, 2012 22:42
-
-
Save srahim/1609171 to your computer and use it in GitHub Desktop.
testing for scrollview contentoffset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({ | |
title:'Tab 1', | |
backgroundColor:'#fff', | |
}); | |
var scrollView = Titanium.UI.createScrollView({ | |
contentWidth:'auto', | |
contentHeight:'auto', | |
top:0, | |
showVerticalScrollIndicator:true, | |
showHorizontalScrollIndicator:true | |
}); | |
var view = Ti.UI.createView({ | |
backgroundColor:'#336699', | |
borderRadius:10, | |
width:3000, | |
height:700, | |
top:10 | |
}); | |
scrollView.add(view); | |
var button = Titanium.UI.createButton({ | |
title:'ContOffset W/O Anim.', | |
height:40, | |
width:200, | |
top:10, | |
left:10 | |
}); | |
view.add(button); | |
button.addEventListener('click', function() | |
{ | |
scrollView.setContentOffset({value:{x:1000,y:20},animated:false}) ; | |
}); | |
var button1 = Titanium.UI.createButton({ | |
title:'ContOffsetwith Animtn', | |
height:40, | |
width:200, | |
top:50, | |
left:1000 | |
}); | |
view.add(button1); | |
button1.addEventListener('click', function() | |
{ | |
scrollView.setContentOffset({value:{x:1000,y:600},animated:true}) ; | |
}); | |
var button2 = Titanium.UI.createButton({ | |
title:'Normal ContentOffset', | |
height:40, | |
width:200, | |
top:600, | |
left:1000 | |
}); | |
view.add(button2); | |
button2.addEventListener('click', function() | |
{ | |
scrollView.setContentOffset({x:10.0,y:10.0}) ; | |
}); | |
win.add(scrollView); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment