Do table views require each row have the same content elements?
Code that works for a small number of rows (<8) with different numbers of icons (image views) blows an exception when the table's larger (9+). Initial display is correct. Scrolling crashes app.
I recreated the crash in Kitchen Sink 1.0, Table View Layout 2 (iPhone SDK 3.1.3, Ti Dev 1.0/SDK 1.0.0) removing alternating "photos" (image views).
table_view_layout_2.js (line 97):
if (c%2) row.add(photo);
1 Answer
-
Accepted Answer
Nope :)
When tableView rows have different layout, you MUST give them a different 'className' or it will crash when scrolling.
You'll see the KS code that each row is set to the className, 'datarow'
So, to use your example test, simply use this instead:
if(c%2){ row.className = 'image_datarow'; row.add(photo); }
(you also wouldn't need the imageView or its click listener in your example too ;) )
hope this helps,
Kosso