I am trying to display font list in a table view so a user can select one of it. However when I open the controller on first time, populating the list is rather slow but the second time to open it, it is very fast.
How can I improve the first initial listing (is it because of the custom fontfamily first loading? I know kitchen sink "Table View (Layout 2) has even more than 30 listing and its very fast to open). My code snippet is like this:
function listFontFamily(textString) { var tableViewDataArray = []; var fontDataArray = ["AlexBrush-Regular", "Aller_Rg", "BebasNeue", "Chunkfive", "Impact_Label_Reversed", "JUICE_Regular", "NEORF", "Pacifico", "Quicksand_Light", "Raleway-Regular"]; var fontDataArrayLength = fontDataArray.length; for (var i = 0; i < fontDataArrayLength; i++) { var fontData = fontDataArray[i]; var tableViewRow = Ti.UI.createTableViewRow({ height : "60dp", fontFamily : fontDataArray[i], }); var fontLabel = Ti.UI.createLabel({ text : fontDataArray[i], height : "25dp", top : "3dp", left : 0, font : { fontFamily : fontDataArray[i], fontSize : "19dp" }, }); var userTextLabel = Ti.UI.createLabel({ text : textString, height : "25dp", top : "28dp", left : 0, font : { fontFamily : fontDataArray[i], fontSize : "15dp" }, }); tableViewRow.add(fontLabel); tableViewRow.add(userTextLabel); fontLabel.addEventListener("click", function(e) { selectedFontFamily(e.source.fontFamily); }); userTextLabel.addEventListener("click", function(e) { selectedFontFamily(e.source.fontFamily); }); tableViewRow.addEventListener("click", function(e) { selectedFontFamily(e.source.fontFamily); }); tableViewDataArray.push(tableViewRow); } $.fitzFontListTableView.setData(tableViewDataArray); }