• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I can't figure out how to use NSIndexSet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I can't figure out how to use NSIndexSet


  • Subject: Re: I can't figure out how to use NSIndexSet
  • From: Cameron Hayne <email@hidden>
  • Date: Thu, 20 Nov 2003 14:35:35 -0500

On 20/11/03 9:02 AM, "John Clayton" <email@hidden> wrote:

> int *buf;
> NSRange myRange
> int indCount = [myIndexSet getIndexes:buf maxCount:200
> inIndexRange:&myRange];

The online docs for NSIndexSet are indeed not the clearest, especially since
this method seems much more C-like than Obj-C/Cocoa-like.
Anyway, as I understand it from the docs (I've never used it), you need to:

1) supply a buffer in which the indices will be placed. I.e. it does not
allocate a buffer - you must have arranged the memory space yourself before
invoking this method. And the buffer should be of type 'unsigned int'

2) supply the range that you are interested in. I.e. the method gives you
info on the indices in the range that you specify and then it changes that
range variable to be appropriate for getting the next bunch of indices.

So an example of use would be:
unsigned int buf[200]
NSRange myRange = NSMakeRange(0, 200);
unsigned int indCount = [myIndexSet getIndexes:buf maxCount:200
inIndexRange:&myRange];
NSLog(@"indCount: %u nextRange: %@", indCount, NSStringFromRange(myRange));

--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >I can't figure out how to use NSIndexSet (From: John Clayton <email@hidden>)

  • Prev by Date: Re: [Now OT] Re: Tunneling mouse events through windows?
  • Next by Date: Re: Mailing list: General options
  • Previous by thread: I can't figure out how to use NSIndexSet
  • Next by thread: Re: I can't figure out how to use NSIndexSet
  • Index(es):
    • Date
    • Thread