Arry of pointers in objective c using NSArray

Posted by Amir on Stack Overflow See other posts from Stack Overflow or by Amir
Published on 2010-05-30T12:03:26Z Indexed on 2010/05/30 12:12 UTC
Read the original article Hit count: 206

Filed under:

Hello,

I am writting program for my iphone and have a qestion.
lets say i have class named my_obj
class my_obj

{  
  NSString  *name;  
  NSinteger  *id;  
  NSinteger  *foo;  
  NSString   *boo;  
}  

now i allocate 100 objects from type my_obj and insert them to array from type NSArray.
then i want to sort the Array in two different ways. one by the name and the second by
the id.

i want to allocate another two arrays from type NSArray

*arraySortByName     
*arraySortById  

what i need to do if i just want the sorted arrays to be referenced to the original array
so i will get two sorted arrays that point to the original array (that didnt changed!)
i other word i dont want to allocate another 100 objects to each sorted array.

© Stack Overflow or respective owner

Related posts about objective-c