TableView Rows Add Labels
Hi All,
I was just wondering if I could add label inside a row directly? This would be very helpful to me as i would then be able to set rows using a webservice which would be way quicker than it is at the moment.
Although everything seems good to me with appcelerator, speed of accessing webservice and then manipulating data is a bit slow (not acceptable) so I am trying everything possible to download content
quicker.
Something like
var myRow = Titanium.UI.createTableViewRow({label:{text:'Hello World',
textAlign:'center', left:5}, label:{text:'Right' right:5}});
Any help inregards to this would be appreciated.
3 Answers
-
It is slow when creating the rows or when accessing the web service?
If it's slow when creating the rows, have you added a className to the rows?
Also don't try to add too many rows in a single shot. -
HI Tamas,
It's the binding of the rows that is slow. As some of my rows contain multiple labels, i have to manually add those labels to the rows like
row.add(label1); row.add(label2);
The webservice is a powerful asp.net service that is cached so that shouldn't be a problem. What is the advantage of adding className? should the className be unique for each row or should it be the same for all rows?
Thanks a lot for your help…
-
Adding a className to the similar rows tells the rendering engine inside the iphone to use the same template for this rows. This will improve a lot the performance.
If you don't do this, it will allocate memory for each row as a new different row, and in the end will move slow or even crash.A good practice would be to add a limited number of rows - even apple does this - and let the user choose to add more.
Also keep in mind that not the response of the server is the one that needs time, but to transfer the data. If you use less data, will be faster.
If you have images in your replay send the right image at the exact size not (bigger) and even optimized - I use ImageOptim for this.