Working with Tables: Writing an Address Book Application
Subject:   Why not this?
Date:   2001-08-15 13:59:43
From:   zootbobbalu
I know their are millions of ways to program the same
thing, so I know this will sound like critisism, but I
can't help myself :-)

What would the pitfalls be if you kept a running count
of the number of deletions and just subtracted this
number from the NSNumber that the NSEnumerator returns with the nextObject message?

It would look something like this:

NSEnumerator *enumerator = [tableView selectedRowEnumerator];
NSNumber *index;
int deletecount;
int modindex;

for (deletecount=0,(index= [enumerator nextObject]), deletecount++ ) {
modindex=[index intValue] - deletecount;
[records removeObjectAtIndex:modindex];

[tableView reloadData];

1 to 1 of 1
  1. Michael Beam photo Why not this?
    2001-08-16 22:25:06  Michael Beam | O'Reilly Author [View]

    • Why not this?
      2002-03-06 13:10:46  jeff_t [View]

      • Why not this?
        2003-02-20 06:30:18  swiftjlc [View]

        • Why not this?
          2003-07-18 17:14:31  rgh [View]

1 to 1 of 1