Last active
April 24, 2016 14:39
-
-
Save nuno/7e32f0b54e3d92d5c10efb5213677b0d to your computer and use it in GitHub Desktop.
Test case scrollableView
This file contains hidden or 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
/** | |
* | |
* 1 - Create a new alloy project and paste this code on index.file file. | |
* | |
* 2 - On index.xml file delete all code, and paste: <Alloy /> tag | |
* | |
* 3 - Run and test, and look at the dots of (showPagingControl) to see the creation time :) | |
* | |
*/ | |
var win = Ti.UI.createWindow(); | |
var view1 = Ti.UI.createView({ | |
backgroundColor : '#123' | |
}); | |
var view2 = Ti.UI.createView({ | |
backgroundColor : '#246' | |
}); | |
var view3 = Ti.UI.createView({ | |
backgroundColor : '#48b' | |
}); | |
// On creation load those 3 views | |
var scrollableView = Ti.UI.createScrollableView({ | |
views : [view1, view2, view3], | |
showPagingControl : true | |
}); | |
// add this view after 2 secs | |
setTimeout(function() { | |
scrollableView.addView(Ti.UI.createView({ | |
backgroundColor : 'yellow' | |
})); | |
console.warn('Yellow view is added - should be added after the window is open'); | |
}, 2000); | |
// add this view after 3 secs | |
setTimeout(function() { | |
scrollableView.addView(Ti.UI.createView({ | |
backgroundColor : 'red' | |
})); | |
console.warn('red view is added - should be added after the window is open'); | |
}, 3000); | |
win.add(scrollableView); | |
console.warn('The first 3 views added, ready to "Open Window"'); | |
win.open(); | |
console.warn('Open Window'); | |
// add this view after 4 secs | |
setTimeout(function() { | |
scrollableView.addView(Ti.UI.createView({ | |
backgroundColor : 'blue' | |
})); | |
console.warn('Blue view is added - should be added after the window is open'); | |
}, 4000); | |
This file contains hidden or 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
[WARN] : The first 3 views added, ready to "Open Window" | |
[WARN] : Open Window | |
[WARN] : Yellow view is added - should be added after the window is open | |
[WARN] : red view is added - should be added after the window is open | |
[WARN] : Blue view is added - should be added after the window is open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment