Skip navigation
This discussion is archived

Why does this reloadData crash my program?

7695 Views 18 Replies Latest reply: Feb 6, 2009 7:18 AM by ElegantMac RSS
  • just.do.it Level 3 Level 3 (840 points)
    Currently Being Moderated
    Oct 16, 2008 10:00 PM (in response to gpmoore)
    Hi,

    what i did in one of my apps, which has a numbered tableView, was renumbering all relevant cells within the moveRow... method.

    basically, i check if one row has been moved up or moved down. Than loop through the relevant indexPaths, calc the appropriate number, get the cellForRowAtIndexPath, set the label.text for the number and that's it. (Mostly)
    MacBook Pro, Mac OS X (10.5.5)
  • vit5112 Calculating status...
    Currently Being Moderated
    Nov 13, 2008 12:12 AM (in response to gpmoore)
    I have the same problem with TableView. Application did crash with this exception during rows reordering in editing mode, backtrace shows nothing useful. This problem appears in my case when ROW HEIGHT of the TableView is 61 pixel only! I set it to 60 and exception is gone.

    I think the problem here is inside Cocoa internal code and this is another one BUG in apple SDK. You can check it yourself by the way. Just create simple application with NavBar, TabBar and TableViewController and string array as rows data (use 10+ strings in array to extend table beyond main window's borders), set "self.tableView.rowHeight = 61;" and try to reorder rows at the bootom of table. Application will crash soon with exception like yours. It will crash only for specified configuration and rowHeight=61, i.e. window->TabBarController->NavController->TableViewController. This is my case.

    So try to change rowHeight in your application, probably this will help to you too.
    Good luck!
    Macbook Pro, Mac OS X (10.5.4), MacbookPro has design "Hello, 20th sentury!"
  • ElegantMac Level 1 Level 1 (25 points)
    Currently Being Moderated
    Feb 6, 2009 7:18 AM (in response to gpmoore)
    I know it's been awhile since you originally posted, but have you tried NSMutableArray's exchangeObjectAtIndex method?

    Looks like this:

    - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
    }

    - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
    \[self.myList exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row\];
    }

    Seemed almost too simple when I found it, but it works.
    24" iMac, Mac OS X (10.5.5), 16GB 3G iPhone
1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.