nsmutablearray

Zombie messaged by [array count]

I have an ivar mutable array which i setup in viewDidLoad as follows: names = [NSMutableArray arrayWithCapacity:30]; [names addObject:@"Joe"]; [names addObject:@"Dom"]; [names addObject:@"Bob"]; Then in a later method, on tap of a button, i do the following, but the array appears to be overreleasing... with Zombie messaged: int r = a...

How do I populate a NSMutableArray with UILabels?

I don't think I am creating this array of UILabels correctly. If I put a breakpoint after this line of code, it shows that the array is empty. colorLabelArray = [[NSMutableArray alloc] initWithObjects: greenLabel, orangeLabel, blackLabel,purpleLabel, yellowLabel, redLabel, blueLabel, whiteLabel, nil]; If I do the same thing with UI...

Objective-c = NSMutableDictionary, Profile & Score recording

Hi! i've been trying to make a system in which i can record the scores of a game, linked with the profile of the player being used. I am not using any on-line leaderboard system (yet), at present I just need to have a score system at its basics. I have managed to make it that the method I am using obtains the score and the profile be...

How to save an NSMutableArray containing NSMutableArrays of custom objects in NSUserDefaults

I was able to save an NSMutableArray of custom objects to NSUserDefaults by implementing NSCoding in the custom class. However, now I want to save an NSMutableArray of these arrays. The compiler complains when I try to do this. How can this be done? ...

NSMutableArray initWithCapacity nuances

Hi, Does anyone have advice on how to best initialize an NSMutableArray when it comes to dictating the capacity? The documentation mentions that "...even though you specify a size when you create an array, the specified size is regarded as a “hint”; the actual size of the array is still 0." So... 1) If I init with a greater capacity t...

Saving NSMutableArray to NSUserDefaults using NSKeyedArchiver

Hi, I'm having trouble retrieving a saved NSMutableArray containing a custom object. The app crashes and the console reports http://pastie.org/1226822. Here is my objects .h file http://pastie.org/1226823. Here is my objects .m file http://pastie.org/1226826. Here is how I save my data http://pastie.org/1226830. Here is how I retrieve my...

crashes my app [NSMutableArray1 removeAllObjects] iphone sdk

i use this code to check if any objects exist in my NSMutableArray if yes i remove them all but it crashes although there are objects why? if([NSMutableArray1 count]==1) { [poemoptionslist removeAllObjects]; } if ([NSMutableArray1 count]==0) { [poemoptionslist addObject: final1]; } CONSOLE OU...

Unique items from a NSMutableArray with NSDictionary items?

If you have an NSMutableArray with three NSDictionarys like this: { name:steve, age:40; name:steve, age:23; name:paul, age:19 } How do I turn that into an array with just two strings { steve, paul }. In other words, the unique names from the original NSMutableArray? Is there a way to do this using blocks? ...

How to change the value of an NSMutableArray at a particular index

[array objectAtIndex:i] doesn't work as an L value, so it can't be used to set the object at index i. ...

From pList (dictionary) to Tableview

I have an editable pList with a dictionary of strings in the format: 21-10-2010 -> @"item1" 20-10-2010 -> @"item2" 19-10-2010 -> @"item3" 18-10-2010 -> @"item4" 17-10-2010 -> @"item5" ect... So with dates in stringformat as keys, and strings with different information as value. The lenght of the dictionary can become up to 2...

Place Images out of NSMutableArray on UIView?

Hi, I have an array of multiple images which I want to display on my screen (2 Columns, 4 Rows). If there are more than 8 Images in the row, than a new view should be created. Can someone please point me in the correct direction how to handle this? Thanks for any feedback! BR, Stefan ...

How to save NSMutableArray of NSValue in CoreData?

I'm doing drawing app for ipad which need to save multiples of NSMutableArray of CGPoint (Converting into NSValue), suggest me for choosing coredata functions or any other approachs for saving more number of arrays ...

Adding Strings and Images to NSDictionary using NSXMLParser

I'm using NSXMLParser to parse a small XML file containing information about videos. One of the elements in the XML is a URL that points to a thumbnail image associated with each video. I'm trying to parse the XML, get the ImageURL and then use this to fetch the image and store it along with strings such as the video name. I just can't ...

NSMutableArray how to properly addObjects and release

Hi all! I am worried about than am I properly adding object and releasing them. What NSMutableArray actually contain - object's copy or just a pointer to them? What is the sequence in working with NSMutableArray? (alloc, init, work, release) How to retain and release it properly? NSMutableArray *listData = [[NSMutableArray alloc] init...

Objective-C Iterating through an NSString to get characters

I have this function: void myFunc(NSString* data) { NSMutableArray *instrs = [[NSMutableArray alloc] initWithCapacity:[data length]]; for (int i=0; i < [data length]; i++) { unichar c = [data characterAtIndex:i]; [instrs addObject:c]; } NSEnumerator *e = [instrs objectEnumerator]; id inst; while (...

Objective C: What is the best way to create and use a dynamic boolean array?

I have been struggling with the best way of creating, accessing and updating values from a dynamic boolean array for more than a week now. @interface myDelegate : NSObject { NSMutableArray *aShowNote; } @property (nonatomic, copy) NSMutableArray *aShowNote; This is how I have initialised my array: NSMutableArray *aShow = [[NSMutab...

NSMutableArray out of scope problem

Hello all! I'm new to objective-C. I want to use NSMutableArray to store some objects i will access later. I've got the interface: @interface ControlWheel : RotatableObject <LeverSubject> { NSMutableArray *subjectArray_; } -(id) initWithCWDef: (ControlWheelDef*) def; -(void) addSubject: (id) subject; @end Here is the implementation...

NSMutable Array and brain damage

I have understandably attracted some smart ass answers to some bone head questions I have asked lately due to my complete misunderstanding of obj c and NSMutable arrays. So I've looked in a book I have and Google and it would appear that may be I shouldn't program because I'm still stuck. Say I'm looping through method A and each loop ...