An immutable, integer indexed, array of objects from Apple Foundation framework.

learn more… | top users | synonyms

384
votes
16answers
165k views

How to 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, let's say they are 'Person' objects. I want to sort the NSMutableArray by ...
128
votes
2answers
59k views

How to sort a NSArray alphabetically?

How can I sort an array filled with [UIFont familyNames] into alphabetical order?
48
votes
7answers
37k views

Sort NSArray of date strings or objects

I have an NSArray that contains date strings like this: "Thu, 21 May 09 19:10:09 -0700" I need to sort the NSArray by date. I thought about converting the date string to an NSDate object first, but ...
166
votes
2answers
113k views

How do I iterate over an NSArray?

I'm looking for the standard idiom to iterate over an NSArray. My code needs to be suitable for OS X 10.4+.
22
votes
4answers
32k views

Using NSPredicate to filter an NSArray based on NSDictionary keys

I have an array of dictionaries. I want to filter the array based on a key. I tried this: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SPORT == %@)", @"Football"]; NSArray ...
0
votes
2answers
648 views

How can I sort an NSArray containing NSDictionaries?

I have an NSArray which contains NSDictionary objects. Each of these NSDictionary objects contains an ORDER key. How can I sort this NSArray based on this key within each of these NSDictionaries?
51
votes
2answers
37k views

Convert NSArray to NSString in Objective-C

I am wondering how to convert an NSArray example: ( [43,545,@"Test"] ) to a string in objective-c. An applescript example might be: set the_array to {43,"Testing", 474343} set the_array to the_array ...
3
votes
6answers
3k views

Maximum amount of objects in NSArray

What is the largest amount of objects I can put in my NSArray?
73
votes
2answers
21k views

Best practice? - Array/Dictionary as a Core Data Entity Attribute

I am new to Core Data. I have noticed that collection types are not available as attribute types and would like to know what the most efficient way is of storing array/dictionary type data as an ...
8
votes
2answers
30k views

Plist Array to NSDictionary

I have a plist: <plist version="1.0"> <array> <dict> <key>name</key> <string>Alabama</string> <key>abreviation</key> ...
27
votes
7answers
4k views

Non-retaining array for delegates

In a Cocoa Touch project, I need a specific class to have not only a single delegate object, but many of them. It looks like I should create an NSArray for these delegates; the problem is that ...
28
votes
10answers
5k views

What's the best way to put a c-struct in an NSArray?

What's the usual way to store c-structures in an NSArray? Advantages, disadvantages, memory handling? Notably, what's the difference between valueWithBytes and valueWithPointer -- raised by justin ...
27
votes
4answers
5k views

Compiler error “expected method not found” when using subscript on NSArray

I wrote this simple code to try out the new Objective-C literal syntax for NSArrays: NSArray *array = @[@"foo"]; NSLog(@"%@", array[0]); The first line works fine, but the subscripting results in ...
3
votes
2answers
7k views

Sorting a NSArray

I have a NSArray of objects. Those objects have an int attribute called "distance". I would like to sort my array by distance. Could someone please tell me how to do that ? I can't understand how the ...
22
votes
3answers
16k views

Difference between NSArray and NSMutableArray

What is the difference b/w NSArray and NSMutableArray ? i am new to iPhone.

1 2 3 4 5 18
15 30 50 per page