去除Array中重复对象

来源:互联网 发布:mysql host 编辑:程序博客网 时间:2024/05/29 11:36

NSArray *copy = [array copy];

NSInteger index = [copy count] -1;

   for (id object in [copy reverseObjectEnumerator]) 

   {

         if ([array indexOfObject:objectinRange:NSMakeRange(0, index)] !=NSNotFound

           {

                 [array removeObjectAtIndex:index];

             }

           index--;

      }

     [copy release];


原创粉丝点击