nsarray

How to add a string into an NSArray at particulap index?

NSInteger timeNum = time; NSMutableArray theResultArray = [[NSMutableArray alloc] init]; [theResultArray insertObject:[NSNumber numberWithInt:timeNum] atIndex:rightIndex]; This is the way we do to insert NSInteger to array. How to i do it for NSString? ...

Can NSArray hold NSDictionary in Objective-C/

Hello, Can each index of array hold the NSDictionary? Thank You. ...

How to inverse the contents of NSArray in Objective-C?

Hello, How do i inverse the contents of NSArray in Objective-C? Assume that i have an array which holds these data NSArray arrayObj = [[NSArray alloc]init]; arrayObj atindex 0 holds this: "1972" arrayObj atindex 1 holds this: "2005" arrayObj atindex 2 holds this: "2006" arrayObj atindex 3 holds this: "2007" Now i want to inverse the ...

Display NSArray values that are stored in an NSDictionary

I'm trying to store an NSArray object with a simple key (1,2,3 etc.) inside an NSDictionary. I'm pretty sure thats worked, but I'm not sure how to display the array data thats stored in there, I've got the following working (displaying a single array of data) The test app i'm working on is a simple dictionary. Definition is the class i'...

Quick NSArray Question - count

Hello! Does nsarray count return the NUMBER of objects (I.E. the first object would be 1, etc) or does it return the max index of the object (I.E. the first one would be 0); Thanks, Christian Stewart ...

How to get a plist data from URL to NSArray ?

Here is my code it looks ok But it crash when running NSString *urlAddress = [NSString stringWithFormat:@"http://www....php"]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlAddress]]; [request setHTTPMethod:@"GET"]; NSData *returnData = [NSURLConnection sen...

Read plist data into a NSArray but get null

I got same warning here “local declaration hides instance variable” warning but I got more problems... Here is my code - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.someaddress.php"] cach...

Getting a Value from NSXMLDocument

I'm using an API to upload an image and I need to get the uploaded image URL (image_link) from the XML output shown below <?xml version="1.0" encoding="iso-8859-1"?><imginfo xmlns="http://ns.imageshack.us/imginfo/7/" version="7" timestamp="1283286280"> <rating> <ratings>0</ratings> <avg>0.0</avg> </rating> <files server="8...

How do I count the objects in an NSArray that have a certain value?

I have an NSArray populated with 0's and 1's. How can I return the number of 0's in the array? Thanks! ...

How can I get an array of the indexes from another array that has been sorted?

I want to sort an array by its objets and then get the indexes like so: NSMutableArray *myArray = [[NSMutableArray alloc] initWithObjects: @"3", @"2", @"1", @"0", @"1", @"2", nil]; I want the indexes of the objects in ascending order. Here, because the lowest value has an index of 3, the indexes would be would be: 3, 2, 4, 1, 5, 0 or ...

why using NSArray (and other non-display graphic element) into Interface Builder

Hi, using IB, i found that you could use NSArray not in a programatic way. I was thinking, great, i can make sets of uiviews into an NSArray and then get a proper outlet in xcode and retreiving all my uiviews from the NSArray. The fact is when i put a NSArray into the nib file, i can't do nothing into it's property list. So the fact is ...

Makin an array of Objects in Objective-C.

Hi guys, Been playing around with Xcode for about 2weeks now, and reading about MVC a bit. I have a problem trying to connect the Model to the Controller because I find it hard to get my head around arrays. I can handle simple arrays when i programmed some in Java but I'm quiet intimidated by the Obj-C NSArrays i see. If somebody woul...

NSMutableArray 'addObject:' Crashing iPhone App

This is my error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance I have no idea why this is happening. Both the array (which is NSMutableArray) and the object being added are definitely not nil, and the @property for the array is straig...

Question about an NSMutableArray of a certain class

Basically I have an NSMutableArray set up like so, with instances of another class as the array elements. [[NSMutableArray alloc] initWithObjects: [[Shape alloc] init], [[Shape alloc] init], nil]; Each of the shape classes has an instance variable that holds what kind of shape it is. I want to be able to make this array so that it ass...

Loop through NSArray objectAtIndex

Hi I have this code: NSInteger *count = [monLessonArrayA count]; for (i = 0; i < count; i++) { arrayVar = [monLessonArrayA objectAtIndex:i]; } I get an error saying i is undeclared, how can I set the objectAtIndex to i so I can loop through increasing it each time? Thanks. ...

Loop through NSArray Setting objectAtIndex Value

Hi I have a bunch of NSStrings in a NSMutableArray. I have added them to the array and now I want to loop through the array, getting each object in it (the strings) and set them to a common value @"No Lessons". This is how I have the loop so far: But how can I get the object then set it? Currently its fairly simple, just getting loopin...

Create a copy of a NSObject

How do I take a NSObject that I have set all the attributes of and then copy that into another block of memory that an array can use so I can re use the original one? ...

NSArray from NSString (in plist format)

Hi there. I use NSURLConnection to get the contents of a plist file from a remote server. On connection:didRecieveData: I add the latest data to an NSMutableString. Now my problem is adding this data to an array. So you have arrayWithContentsOfURL - which is synchronous - but i suppose I could just add the contents of the NSString to ...

Custom Classes not being retained

I have a NSXMLParser that parses YT's API. It then turns all the videos into a class I wrote called video. Then the class is put into an array. Then back at my rootviewcontroller I access xmlParser.allVideos (xmlParser is a class I wrote that is the delegate for the xml parser. Here is what I do with it in the viewDidLoad: arrayFromXML ...

how to convert NSArray to NSData...or something...

I am rather embarrassed to ask this, but I am on a time limit. basically, i need to get an array which can hold integers and then those integers can be used to plot a point on an image. I am trying to make a program where random objects travel down the screen following certain paths, but at random. So far this is my code: enemyPaths ...