On 17-Sep-2009, at 10:50 PM, Tommy Nordgren wrote:


On 17 sep 2009, at 15.23, steven Hooley wrote:

- shiftIndexesStartingAtIndex:by: and
-containsIndexesInRange:NSMakeRange: don't seem to play nicely
together..
Is this expected?

NSMutableIndexSet *someIndexes = [NSMutableIndexSet indexSet];
[someIndexes addIndex:0];
[someIndexes addIndex:2];
[someIndexes shiftIndexesStartingAtIndex:2 by:-1];

BOOL result1 = [someIndexes containsIndex:0];
BOOL result2 = [someIndexes containsIndex:1];
BOOL result3 = [someIndexes containsIndexesInRange:NSMakeRange(0,2)];

        Here is the error. You are asking if the index set contains (0,1,2),
But it only contains (0, 1) after the shift
        Try using NSMakeRange (0,1) instead.

But NSMakeRange takes (index, length) not ( start index, end index ) so the original post seems correct. _______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to