All Questions

1126
votes
23answers
425785 views

How do I sort an NSMutableArray with custom objects in it?

What I want to do seems pretty simple, but I can't find any answers on the web. I have an NSMutableArray of objects, and let's say they are 'Person' objects. I want to sort the NSMutableArray by Perso...
50
votes
3answers
64219 views

NSMutableArray addObject not working

I have declared an NSMutableArray *categories in my view controller .h file, and declared a property for it. In the parser:foundCharacters: method of the NSXMLParser delegate in my .m file, I have t...
0
votes
2answers
1356 views

NSMutableArray addObject not affecting count?

Can anyone tell me why logging [self.giftees count] keeps returning 0 even though I'm adding objects to it? header: #import <UIKit/UIKit.h> @interface Test2AppDelegate : NSObject <UIApplic...
-1
votes
4answers
761 views

Cannot add items to an NSMutableArray ivar

My goal is to add a string to array, and I do that in a method which I call. In this method, I get a null value in the array, and don't know why. I have this at the start of my class: NSMutableArray...
136
votes
13answers
89181 views

The best way to remove duplicate values from NSMutableArray in Objective-C?

The best way to remove duplicate values (NSString) from NSMutableArray in Objective-C? Is this the easiest and right way to do it? uniquearray = [[NSSet setWithArray:yourarray] allObjects];
28
votes
3answers
61723 views

How to sort NSMutableArray using sortedArrayUsingDescriptors?

I have a question about sorting NSMutableArray. I can use sortedArrayUsingDescriptors: method to sort an array with objects. For example I have an NSMutableArray of places where I have an attribut...
58
votes
12answers
39143 views

NSMutableArray - force the array to hold specific object type only

Is there a way to force NSMutableArray to hold one specific object type only? I have classes definitions as follow: @interface Wheel:NSObject { int size; float diameter; } @end ...
60
votes
8answers
61796 views

How do copy and mutableCopy apply to NSArray and NSMutableArray?

What is the difference between copy and mutableCopy when used on either an NSArray or an NSMutableArray? This is my understanding; is it correct? // ** NSArray ** NSArray *myArray_imu = [NSArray ar...
50
votes
9answers
65137 views

How to save NSMutablearray in NSUserDefaults

I have two NSMutableArray's. They consist of images or text. The arrays are displayed via a UITableView. When I kill the app the data within the UITableView gets lost. How to save array in UITableView...
39
votes
6answers
16558 views

Finding Intersection of NSMutableArrays

I have three NSMutableArray containing names that are added to the lists according to different criterieas. Here are my arrays pseudocode: NSMutableArray *array1 = [@"Jack", @"John", @"Daniel", @"Li...

Previous Next