How to create GridView for iOS (iPhone/iPhone5/ iPad) How to get Gridview in Potrait 33 matrix and in landscape 4*2 matrix.
var topGrid = 0;
var leftGrid = 0;
var containerHeight = 108;
var containerWidth = 106;
//
for(var i=0; i<9; i++){
var view_Grid = Titanium.UI.createView({
width:containerWidth,
height:containerHeight,
backgroundColor:'red',
borderColor:'green',
borderRadius:'4',
borderWidth:'2',
});
// alert(leftGrid);
if(leftGrid > 212){
topGrid = topGrid+containerHeight;
leftGrid = 0;
}
view_Grid.top=topGrid;
view_Grid.left=leftGrid;
leftGrid = leftGrid + containerWidth;
$.view_GridBox.add(view_Grid);
}
Can any one advice me how to achieve it in dynamically for IOS.
@All Thanks in advance
You can try this
var win = Ti.UI.createWindow({ backgroundColor : 'white' }); win.open();
var scroll = Ti.UI.createScrollView({ top : '50', bottom : '50', left : '0', right : '0', backgroundColor : 'black', contentWidth : '98%', layout : 'horizontal' }); win.add(scroll);
var view = [];
for(var i=0;i<15;i++){ view[i] = Ti.UI.createView({ height : '63', width : '63', left : '12', top : '15', backgroundColor : 'cyan' }); scroll.add(view[i]); } var blank = Ti.UI.createView({ height : '20', width : '110%' }); scroll.add(blank);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.