nsmutablearray

Search string in NSMutableArray for showing in Table.

Okay, I have an Book Object Class. That has Book.name and Book.id as extensions. Book.name being NSString. Which is what should be searchable and listed in UITableView. NSMutableArray *matchingSymptomsArray = [[NSMutableArray alloc] initWithCapacity:50]; for(NSMutableArray *letterArray in DataArray){ for(Book *bk in letterArray){...

how are these NSMutableArray initializations different?

In a branch of my code, I previously used this NSMutableArray *array1 = [[NSMutableArray alloc] init]; The above array is used populate a UITableVew. Just cause, I switched to the following: NSMutableArray *array1 = [NSMutableArray arrayWithCapacity:0] I made no other changes to my code) and my app crashes whenever I try to scrol...

Total Size of NSMutableArray object

Hi Folks, I've got an NSMutableArray that holds a bunch of objects, what I'm trying to figure out is how much memory is the array using. After looking at a couple of places I know about the sizeof call, and when I make it I get 32 bits (which is the size of the NSMutableArray object it self). Example code: NSMutableArray *temp = [[NSM...

Can not load an archived NSMutableArray into a new NSMutableArray

The App will save the NSMutableArray into a archive with no problems but as soon as I try and load the NSMutableArray back into a new NSMutableArray @ viewDidLoad the app will crash. I put a break point at the end of the code where "tempArray = [unarchiver decodeObjectForKey:kDataKey46];" and tempArray is being loaded with the archived ...

Filter a NSMutableArray index beyond bounds Problem

I am trying to filter a NSMutableArray. Search array for items by certain country. I have tried NSpredicate which works great however I need to re-use the original array which I cannot with NSpredicate. So I am trying the below code. Q. What is the best way to filter an NSMutableArray keeping the original array intact? //The followin...

iPhone, show NSMutable Array containing NSStrings in UIPickerView

I have a method with the following code: NSMutableArray *pickerArray = [[NSMutableArray alloc] init]; int i; for(i = 1; i <= 7; i++) { NSString *myString = [NSString stringWithFormat:@"%@", i]; [pickerArray addObject:myString]; } for(i = 1; i <= 7; i++) { NSString *fieldName = [[NSString alloc] initWith...

Take some object in NSArray and put it randomly in labels

I choose index of an array from a plist. It's a dictionary with 10 different line with string. NSArray* tableau = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"codes" ofType:@"plist"]]; NSDictionary* phrase = [tableau objectAtIndex:nombreChoisi]; I would like to take 6 elements and put them in 6 labels...

UITableView corruption upon scroll.

Hello all, Im trying to get a UITableView to display items contained within an array. This array is contained within a class (HX_ParkingSearch). I have a ref to this class that contains the array inside the app delegate class, to enable the views to access it. Problem is that I get one page of results displaying correctly inside the tab...

Cocoa-Touch. What Exactly is the Difference Between These NSMutableData Methods?

One thing I'm a bit unclear on is the difference between these NSMutableArray Methods: // Class Method Style NSMutableData *myMutableDataInstance = [NSMutableData dataWithLength:WholeLottaData]; and // Instance Method Style NSMutableData *myMutableDataInstance = nil; myMutableDataInstance = [[[NSMutableData alloc] initWithLength:...

Resetting NSMutableArray

What is the best a quickest way to reset an NSMutableArray? ...

NSMutable Array - objectAtIndex: index beyond bounds

Hi everyone, I'm trying to look through a NSMutableDictionary loaded with an NSMutableArray and I'm messing it up, and I don't know how. I'm trying to load a larger plist of game questions, then delete them if they aren't the right level. I don't get an error until I try and delete. Can anyone see the flaw in this code? I'd super ap...

NSMutable Array

Hello, I have a NSMutableArray: NSMutableArray *temp = //get list from somewhere. Now there is one method objectAtIndex which returns the object at specified index. What I want to do is that, I want to first check whether an object at specified index exists or not. If it exists than I want to fetch that object. Something like: if (...

NSXMLParser iPhone memory strategy for large xml

Hi I build a parsing algorithm using NSXMLParser. Im having doubt as to what is the best strategy for keeping my memory usage on a minimum. I have a valueObject (e.g. "Person") this object has ≈ 30 NSString properties, while parsing the xml I continually alloc and release a temporary Person object as the nodes are traversed. I checked ...

algorithm to add randomly-generated NSStrings to NSMutableArray

The goal is to generate an NSString chars in length and assign each string to an array. I'm getting stuck on what I need to do with my algorithm to get the correct result. Here's the sample. The result I get is the same randomly generated string added to my array 26 times instead of 26 DIFFERENT strings added. I've thought about de...

UITableView, how do I know what Section during cellForRowAtIndexPath?

I have a UITableView displaying a list of Cities. I want to separate them by State. I can't seem to figure out how to get it to pick the right items out of my Array. If Section 1 (Arizona) has 2 Cities and Section 2 (California) has 2 Cities, during cellForRowAtIndexPath, Section 2, City 1 has an index of 0, even though it's the 3rd ite...

NSMutableArray addObject, unrecognized selector

I'm trying to create an array (States) of arrays (Cities). Whenever I try to add an item to my City array I get this error: 'NSInvalidArgumentException', reason: '*** +[NSMutableArray addObject:]: unrecognized selector sent to class 0x303097a0 My code is as follows. The line it errors on is [currentCities addObject:city]; I'm sur...

Problem with NSMutableArray arrayWithObjects:

NSMutableArray *images = [NSMutableArray arrayWithObjects:[UIImage imageNamed:@"JGirl 01.jpg"], [UIImage imageNamed:@"JGirl 03.jpg"], ... , [UIImage imageNamed:@"JGirl 48.jpg"], nil]; self.view = [[[SlideShowView alloc] initWithImages:images byIndex:index] autorelease]; assume that my images contain 48 object but when i de...

Objective-C, sorting an array based on a objects instance variable.

I'm working on a game like Rodents Revenge, just to point out where I'm coming from with this question. I'm using the cocos2d game engine aswell... I have a layer that contains about 168 blocks, these blocks are a subclass of a Sprite. Each block contains two instance variables that are integers, one for the xGridLocation and yGridLocat...

Null selector sent to first item in NSMutableArray

Whenever I call this method: - (IBAction)addListItem: (id)sender { NSString *newItemText = [inputField stringValue]; TodoItem *newItem = [[TodoItem alloc] initWithGUID:nil text:newItemText]; [newItem autorelease]; [self willChangeValueForKey: @"list"]; [list addObject: newItem]; [self didChangeValueFo...

MutableArray loaded with a .plist file Boolean Value. How do I test whether True or False??

I seem to have a problem understanding how to conditionally test a boolean value loaded from a .plist to a mutablearray. I simply dont understand what i am supposed to do and continue to receive an error: Passing argument 1 of 'numberWithBool:" makes integer from pointer without a cast. any help understanding this is appreciated! he...