views:

60

answers:

2

i tried doign this: Values = [[NSSet setWithArray:Values] allObjects]; and no sucess,

Thanks

+2  A: 

Your method should work, except it returns an NSArray instead of NSMutableArray. You could use

[values setArray:[[NSSet setWithArray:values] allObjects]];

to set values to the content of the new array.

KennyTM
Also if (x = [Values count]) how would i do that ? thanks
@user393273: ??
KennyTM
A: 

Note that the NSSet method may remove any order you have in your NSArray. You might want to loop thru your array to keep the order. Something like this:

NSMutableArray* uniqueValues = [[NSMutableArray alloc] init]; 
for(id e in Values)
{
    if(![uniqueValues containsObject:e])
    {
        [uniqueValues addObject:e];
    }
}
Sander Backus