Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created October 22, 2010 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/641174 to your computer and use it in GitHub Desktop.
Save anonymous/641174 to your computer and use it in GitHub Desktop.
var win = Titanium.UI.currentWindow;
var view0 = Titanium.UI.createScrollView({backgroundColor:'#f00'});
var view1 = Titanium.UI.createScrollView({backgroundColor:'#0f0'});
var view2 = Titanium.UI.createScrollView({backgroundColor:'#00f'});
var scrollableView = Titanium.UI.createScrollableView({
views:[view0,view1,view2]
});
var text0 = Ti.UI.createLabel({
text:"view 0",
width:"auto",
height:"auto",
top:10
});
view0.add(text0);
var b1 = Ti.UI.createButton({
height:40,
width:200,
title:'Remove View1 from middle [in sequence]',
top:140
});
view0.add(b1);
var b2 = Ti.UI.createButton({
height:40,
width:200,
title:'Remove View1 from middle [error!]',
top:200
});
view0.add(b2);
var text1 = Ti.UI.createLabel({
text:"view 1",
width:"auto",
height:"auto",
top:10
});
view1.add(text1);
var text2 = Ti.UI.createLabel({
text:"view 2",
width:"auto",
height:"auto",
top:10
});
view2.add(text2);
b1.addEventListener('click', function(){
Ti.API.info('***************************************');
scrollableView.removeView(view2);
scrollableView.removeView(view1);
scrollableView.addView(view2);
Ti.API.info('removing view1 from the middle [in sequence]');
});
b2.addEventListener('click', function(){
Ti.API.info('***************************************');
scrollableView.removeView(view1);
Ti.API.info('removing view1 from the middle [error!]');
});
scrollableView.addEventListener('scroll', function(e){
Ti.API.info('***************************************');
Ti.API.info('scrollable view scroll currentPage: '+e.currentPage);
});
//scrollableView.removeView(view1);
win.add(scrollableView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment