Table Rows + RightImage/Button + Scroll = Crash
I keep running into problems with TableViews that seem to be caused or made evident by the use of the "rightImage" attribute of the row, or by trying to use a button in the row.
Here's some short example code (~100 lines):
To sum up the code:
- A TableView with 3 sections is created and added to the window.
- The first section has four rows, each containing a label.
- The second section is simply one long label.
- The third section has four rows, each containing a button.
- If you scroll to the bottom of the window, and then scroll back up, Titanium will immediately crash when the top section comes back into view.
For whatever reason, removing the buttons from the third section prevents the crash. So I figured I would instead try using the "rightImage" property of the Table row. (You can comment out line 88 and uncomment line 85 to try this). Now when you scroll to the bottom and back up, there is no longer a crash, but the rightImage that you specify is suddenly added to the top section as well!
Any ideas? This seems to be some sort of redraw issue, as the problem doesn't manifest itself if rows are never scrolled out of the view.
I am using Titanium SDK 1.3.0 and Titanium developer 1.2.1.
1 Answer
-
Accepted Answer
As you mentionned removing this code is ok:
var rightButton = Ti.UI.createButton({ style: Ti.UI.iPhone.SystemButton.DISCLOSURE });
For the refresh issue you need to do an explicit specification of empty rightImage for your first Section (with 4 rows):
var sectionRow = Ti.UI.createTableViewRow({ height: 'auto', rightImage: '' });