Problem
I have x amount of ImageViews that are all different sizes. For each ImageView I have captions (labels) that overlay the image and the coords are set by a left/top percentage. The problem is the only way to currently retrieve these views is to get a reference to the currentview and call the toImage method to get the size. I would think by adding a post layout to each view or to the ScrollableView you should be able to get that views size when it is scrolled to.
Snippet
var imageViewArray = [];
var colors = ['red', 'orange', 'yellow'];
for (var c = 0; c < colors.length; c++) {
//Views work, ImageViews do not.
var iv = Ti.UI.createImageView({
//var iv = Ti.UI.createView({ //it works
backgroundColor : colors[c],
width : '100%',
height : '100%'
});
iv.addEventListener('postlayout', function() {
//alert('hoping this would work ');
Ti.API.info(' hoping this would work: ' + c);
});
imageViewArray.push(iv);
}
var self = Titanium.UI.createScrollableView({
views : imageViewArray,
currentPage : 0,
});
self.addEventListener('postlayout', function() {
alert('this only is for Scrollableview');
});
var win = Ti.UI.createWindow();
win.add(self);
win.open();
[Moved to description]
Do you need anything else from me to get this pushed closer to a fix?