Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

scrollView vertical cut off in bottom when capture event orientation change

$
0
0

Hello, i try to add several views into a parent view and add this parent view to a scrollView. At the beginning all works fine, but when i capture the event 'orientation change' and draw the views, the scroll view cut off the content in bottom. I remove all the content in the parent view and add his content again, set the content height with Ti.UI.SIZE dynamically, etc... but nothing works.

this is the part of the code to handle the orientation change:

//Handle orientation change
Ti.Gesture.addEventListener('orientationchange', function(e) {
    //clean the parent view and the scroll view
    $.uiProd_tablet.ventana.children[0].remove($.uiProd_tablet.contenedor_vistas);
    $.uiProd_tablet.contenedor_vistas.removeAllChildren();
    vistaTablet = [];
 
 
    creaVistasPort_Land(vista.length, vista);
 
    for(var j=0; j<vistaTablet.length; j++)
        $.uiProd_tablet.contenedor_vistas.add(vistaTablet[j]);
 
    $.uiProd_tablet.ventana.children[0].add($.uiProd_tablet.contenedor_vistas);
});
 
 
//draw the views
var creaVistasPort_Land = function(cant_productos, producto){
    Ti.API.info(cant_productos);
    var width = Ti.Platform.displayCaps.platformWidth;
    var height = Ti.Platform.displayCaps.platformHeight;
    if(width < height){
        Ti.API.info("entra en portrait!");
        var mod = cant_productos%2;
        var div = Math.floor(cant_productos/2);
        var index = 0;
        for(var i=0;i< (mod+div); i++){
            vistaTablet[i] = Ti.UI.createView({
                width: '100%',
                height: Ti.UI.SIZE,
                left: 0,
                top: 0,
                layout: 'horizontal'
            });
            for(var j=0; j<2; j++){
                //Reestructuramos para portrait
                producto[index].getView().width = width*0.5;
                vistaTablet[i].add(producto[index].getView());
                index++;
                if(index > cant_productos) break;
            }
        }
    }
    else{
        var mod = cant_productos%3;
        var div = Math.floor(cant_productos/3);
        var index = 0;
        Ti.API.info("entra en landscape!");
        for(var i=0;i< (mod+div); i++){
            vistaTablet[i] = Ti.UI.createView({
                width: '100%',
                height: Ti.UI.SIZE,
                left: 0,
                top: 0,
                layout: 'horizontal'
            });
            for(var j=0; j<3; j++){
                //Reestructuramos para landscape
                producto[index].getView().width = width*0.33;
                vistaTablet[i].add(producto[index].getView());
                index++;
                if(index > (cant_productos-1)) break;
            }
        }
    }
};
the $.uiProd_tablet.ventana.children[0] is the scroll view, and i try to do this in Ipad simulator.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>