Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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):

Pastie

To sum up the code:

  1. A TableView with 3 sections is created and added to the window.
  2. The first section has four rows, each containing a label.
  3. The second section is simply one long label.
  4. The third section has four rows, each containing a button.
  5. 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.

— asked June 19th 2010 by Mike Dosey
  • 1.3.0
  • crash
  • iphone
  • mobile
  • rightimage
  • row
  • scroll
  • table
  • tableview
0 Comments

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: ''
       });
    
    — answered June 19th 2010 by Stephane Pelamourgues
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.