Tagged Questions
93
votes
4answers
66k views
Convert NSArray to NSString in Objective-C
I am wondering how to convert an NSArray [1,@"Hello",3,4,5] to an string in Objective-C. An Applescript example is:
set the_array to {1,"Two", 3,4,5,6}
set the_array to the_array as string
5
votes
2answers
5k views
Pick random element of NSArray in Objective-C [duplicate]
Possible Duplicate:
Picking a Random Object in an NSArray
I have have an array in Objective-C with strings:
NSArray *tips;
tips = [NSArray arrayWithObjects:
@"Foo",
@"Bar",
...
6
votes
3answers
7k views
Get NSIndexSet from NSArray
NSArray has useful methods to find objects for specified indexes
// To find objects by indexes
- (id)objectAtIndex:(NSUInteger)index
- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes
// To find ...
13
votes
1answer
16k views
Comma-separated string to NSArray in Objective-C
So I have no experience with arrays... But I need to use one to populate a UIPickerView. I am obtaining a list of objects via HTTP (NSURLConnection). This works fine. Currently, the response is stored ...
11
votes
4answers
13k views
makeObjectsPerformSelector:
I want to make all objects in an array perform a selector. I've discovered the appropriately named makeObjectsPerformSelector: method, but I have a question with it. If I use it on an array, will it ...
0
votes
2answers
4k views
Save JSon data in NSArray
I'm trying to save some specific JSon data and store them in a simple NSArray.
This is the JSon I have:
products = {
72 = {
value_a = "something1";
value_b = "something2";
...
8
votes
3answers
201 views
Enumerate NSArray starting at givven index searching both ways (no wrap around)
Example. I've got an array with 15 objects. I want to start enumerating from a given index. Say start at index 5 and then the index above, the index under, above, under etc... I don't want it to wrap ...
2
votes
1answer
2k views
Save Array to plist
I'm trying to store some items into a pList. Here is the array loop:
for (id obj in items)
NSLog(@"obj: %@", obj);
Output NSLog:
2013-03-27 13:00:40.072 mycode[47436:c07] obj: Red
2013-03-27 ...
1
vote
4answers
277 views
NSArray size and mutability
In Java, I commonly initialize arrays that are a specific size and then add and replace objects as my code goes on. In Objective C, I can't do that with an NSArray. Code that I have ported over from ...
-1
votes
1answer
35 views
how to chose an array( column) from a given file.txt? (stringByAppendingPathComponent) X-code
i am trying to pick an array (column) from a given file that contains arrays of numbers e.g:
2012-09-02 16:27:15.010 SMA -0.818863 0.286575 0.206177 -0.108286 -0.231033 -0.303317
2012-09-02 ...