Skip to content

Instantly share code, notes, and snippets.

@AppWerft
Created October 10, 2014 20:19
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 AppWerft/9818448ad2f26f6c6876 to your computer and use it in GitHub Desktop.
Save AppWerft/9818448ad2f26f6c6876 to your computer and use it in GitHub Desktop.
var Module = function(_page) {
var dummyrow = Ti.UI.createTableViewRow({
selectionStyle : Ti.UI.iPhone.TableViewCellSelectionStyle.NONE,
});
var self = Ti.UI.createTableView({
scrollable : false,
width : Ti.UI.FILL,
height : Ti.UI.FILL,
backgroundColor : '#fff',
data : [dummyrow]
});
switch (Ti.Platform.displayCaps.platformWidth) {
case 1024 :
var w = (1024 - 5 * PADDING) / 4, h = w / 1.08;
for (var i = 0; i < 20; i++) {
var col = i % 4, row = Math.floor(i / 4);
dummyrow.add(require('ui/tile.widget')({
left : col * (PADDING + w) + PADDING,
top : row * (h + PADDING) + PADDING,
width : w,
height : h,
title : 'Titel',
subtitle : 'Erklärender Text zur Kachel, wichtig zu wissen',
image : 'http://lorempixel.com/320/240/?' + i + '-' + _page
}));
}
break;
case 320:
var w = (320 - 3 * PADDING) / 2, h = w / 1.2;
for (var i = 0; i < 10; i++) {
dummyrow.add(require('ui/tile.widget')({
left : (i % 2) * (PADDING + w) + PADDING,
top : Math.floor(i / 2) * (h + PADDING) + PADDING,
width : w,
title : 'Titel',
subtitle : 'Erklärender Text zur Kachel, wichtig zu wissen',
height : h,
image : 'http://lorempixel.com/320/240/?' + i + '-' + _page
}));
}
}
self.addEventListener('click', function(_e) {
alert(_e );
console.log('itemclick');
require('ui/catalog.window')().open({
transition : Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
});
});
return self;
};
module.exports = Module;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment