nsarray

UITableView Looping Out Data From NSMutableArray / NSDictionary

Hi there, I'm currently building an iPhone app that will display data from an NSMutableArray called "stories". The array structure looks like so (via NSLog): 2009-07-20 12:38:30.541 testapp[4797:20b] ( { link = "http://www.testing.com"; message = "testing"; username = "test"; }, { link = "http://www.testing...

How do I draw a shape in Quartz Composer for every element in an NSArray?

I have an XML file that I have parsed and have put the information I want into several NSArray objects. I want to be able to draw them in a QuartzView (anything better?) to visualize the data. The arrays should all hypothetically contain the same amount of info. I want one array to represent the x axis and another the y. It took long...

pointer memory management misunderstanding w/ objective-c

Hi, I'm using the iPhone SDK 3.0, but I think this is a general misunderstanding of how things work w/ c & memory management. I've overridden the viewWillAppear method like this @implementation MyViewController - (void)viewWillAppear:(BOOL)animated { NSArray *items = [NSArray arrayWithOjbects:self.searchButton, self.trashCan, nil]; ...

Loop and changing variable.

Hello, I have a for loop as below which populates this data into an array. I would like this to essentially populate 15 different array's, I have written some Pseudo code below. Is this achievable? for (int y = 1; y < 16; y++) { NSArray *array + y = item } ...

Copying an NSArray with mutable copies of the original elements

I am creating an array of dictionaries in a class. I want to return a copy of that array to any other object that asks for it. This copy that is passed to other objects needs to be modified without modifying the original. So I am using the following in a getter method of my class that holds the "master" array: [[NSMutableArray alloc] i...

Error while creating an nsarray from plist?

I am trying to create an NSArray from a .plist file, but I keep getting this error: "'NSUnknownKeyException', reason: '[<NSCFString 0x5bbca60> valueForUndefinedKey:]: this class is not key value coding-compliant for the key Value1.'" In the .plist file, I have a key called "Item 1" and a string value called "Value1." Then in the code...

iPhone UIImageView Array

So I'm declaring a NSMutableArray to hold 5 UIImageViews. .h file: @interface ImageDisplay : UIViewController { IBOutlet UIImageView *img1; IBOutlet UIImageView *img2; IBOutlet UIImageView *img3; IBOutlet UIImageView *img4; IBOutlet UIImageView *img5; NSMutableArray *imageHolderArray; } @property (nonatomic, re...

What is the NSObject isEqual: and hash default function?

I have a database model class that is a NSObject. I have a set of these objects in a NSMutableArray. I use indexOfObject: to find a match. Problem is the model object's memory address changes. So I am overriding the hash method to return the model's row ID. This however does not fix it. I also have to override the isEqual: method to comp...

Does NSArray copy objects?

When I make an NSArray using +[NSArray arrayWithObjects:], does it copy those objects? If I release the objects after adding them to the array, will I run into problems? ...

How create an Global Variable for all the project type NSArray

Hello, I would like to know how can I create a global variable type NSArray that i can use (write in/read data) from any class from y app. At the moment i'm using NSUserDefaults, but I don't think this is the best option, because i'm saving one NSArray quite big. Thanks. ...

iPhone dev - create array in init or viewDidLoad

In my UIViewController subclass should I initialize the NSArray of data for the UIPickerView in init or in viewDidLoad and why? Thanks. ...

Would NSMutableArray -removeObject: also remove a NSString if it has a different memory adress?

Example: I add some NSString objects to an NSMutableArray: @"Foo", @"Bar", @“FooBar". Now somewhere else I access that array again, and I want to delete @"Foo". So I create a new NSString @"Foo", and pass it to -removeObject:. The documentation does not state on what criteria -removeObject works. I think that it looks only for the memory...

Error when retaining NS(Mutable)Array in a class

Hi, I'm having a hard time working with arrays. Coming from AS2/AS3 and garbage collection is new to me ... ;) This is not the full code, just the parts that matter. .h-file @interface HelperViewController : UIViewController { NSMutableArray *pagesNumbers; } @property (nonatomic, retain) NSMutableArray *pagesNumbers; .m-file @syn...

How to get an NSarray of all file names in a directory on a remote server?

How do I get an NSArray of the NAMES of all files stored in a specific directory such as: "http://www.someurl/somedirectory/"? ...

Plist Array to NSDictionary

I have a plist: <plist version="1.0"> <array> <dict> <key>name</key> <string>Alabama</string> <key>abreviation</key> <string>AL</string> <key>date</key> <string>1819</string> <key>population</key> <string>4,627,851</string> <key>capital</key> <string>Montgomery</string> ...

Difference b/w NSArray and NSMutableArray

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

How to sort a NSArray Alphabetically?

I have an array filled with [UIFont familyNames] but they aren't in alphabetical order. How do I do this? ...

How to do sparse array in Cocoa

I have an undetermined size for a dataset based on unique integer keys. I would like to use an NSMutableArray for fast lookup since all my keys are integer based. I want to do this. NSMutableArray* data = [NSMutableArray array]; // just create with 0 size then later people will start throwing data at me with integer indexes (all un...

Deallocating NSMutableArray objects

This is my 'tick' function: - (void) tick: (ccTime) dt { NSLog(@"%d",ticker); if(fbut.Adown == YES && ticker > 4)//fbut is a button { elayer = [[effectsLayer alloc] init]; // each effectlayer draws a //projectile that moves forward 'x' ticks elayer.e_playpos = glayer.playerpos; // player position [self addChild:elayer z:2]...

Does NSMutableArray's -removeLastObject RELEASE the object?

I'm talking about methods like -removeAllObjects, -removeLastObject, etc for NSMutableArray. The documentation only says that these methods 'remove' the object from the array. Are the removed objects released? ...