nsmutablearray

NSMutableArray of Objects misbehaves ...

I hope someone understands what happens to my NSMutableArray. I read records a, b, c, d from a database, load the fields into an object an add the object to an array. To do this I read the records into an instance of that object (tmpEvent) and add the Object to the target array (NSMutableArray myArray). the code looks like: for (condi...

Can I restrict the NSMutableArray object type?

I want the NSMutableArray only store "MyObject" only... ...instead of any objects. How can I do this? thz. ...

Saving an NSMutableArray of custom Objects

I have a custom class that is used as a wrapper to an NSMutableArray @interface AllCourses : NSObject { NSMutableArray *arrClasses; } The array above stores Objects of another custom class. @interface Course : NSObject { NSString *className; NSString *classGrade; NSInteger creditHours; } I use the method below to add Course obje...

How to sort an NSMutableArray of objects by a member of its class, that is an int or float

I have a class (from NSObject) that contains: NSString name int position float speed I then create an array (NSMutableArray) of objects from this class. I would like to then sort the array by the 'speed' value, which is a float. I initially has the float value as an NSNumber and the int as NSInteger, and I was successfully s...

Fetching Core Data for Tableview on iPhone - Tutorial leaves me with crashes when adding items to a list

Been following the Core Data tutorial on Apple's developer site, and all is good until I have to add something to the fetched store. I am getting this error after a successful build and load when I try to add a new item to the list: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update:...

Objective-C iPhone - NSMutableArray addobject becomes immediately out of scope.

ok. I have a really odd and mind boggling problem. I have two class files, both of which are NSObject inheritors. The series of code is as follows CustomClass *obj; obj = [[CustomClass alloc] init]; [myArray addObject:obj]; <--------Immediately after this line if I hover over the array it shows it as having 1 object that is out of ...

How to sort filenames correctly like Finder in objective-c

I am binding NStableView with NSMutableArray contiaining filenames and other file details. Simple biniding and sorting with compare: is not properly sorting file names like finder. Please let me know if i need to define custom selector for sorting filenames and how? ...

How to insert object already existing objects in NSMutableArray list.

I am getting a problem, while inserting an object into the main List. [editContactList addObject:editcontacts]; [editObject.contactList insertObject:editContactList atIndex:0];//error as mutating method sent to immutable object [editcontacts release]; ...

When I am replacing or inserting an object into nsmutable array, I am getting an Exception.

While replacing or inserting into an NSMutable array, I am getting exception as: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object' [list replaceObjectAtIndex:indexRow withObject:editcontacts]; //or [list ...

Object in NSMutableArray crushed in memory

Hi, I have some big problem with an NSMutableArray I'm filling with objects in a database. I'm using [appDelegate.myArray addObject:myObject], then somehow the object gets crushed in the memory, I don't know why, I didn't release anything... Thanks for your answers (and sorry for my poor english xD) ...

Why doesen't it work to write this NSMutableArray to a plist?

edited. Hey, I am trying to write an NSMutableArray to a plist. The compiler does not show any errors, but it does not write to the plist anyway. I have tried this on a real device too, not just the Simulator. Basically, what this code does, is that when you click the accessoryView of a UITableViewCell, it gets the indexPath pressed, e...

NSMutableArray with only a particular type of objects

Hello, is it possible to specify that a NSMutableArray can only contain a certain type of objects. For example, if I want to store only this kind of objects : @interface MyObject : NSObject { UInt8 value; } In order to be able to use the instance variable like this : - (void)myMethod:(NSMutableArray *)myArray{ for (id myObje...

Replacing a UIImageView inside of an NSMutableArray - weird redrawing issue

I have an NSMutableArray of UIImageViews that have been added as subviews of a particular view. When I replace a view like this: UIImageView *tempview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]]; tempview.frame = CGRectMake(0, 0, 667, 920); [drawViewController.drawImage replaceObjectAtIndex:0 withObject...

convert string to date and write back into NSMutableArray

I have a NSMutableArray I get by loading a plist into it. The date field comes in as a string and i want to change it into a nsdate. I can change an nsstring into an nsdate. My array is an array of objects like the one below; { Date = "1/1/2009" Description = "Have you ever looked at a badger and thought i wonder how far...

Get a tableview insertRowsAtIndexPaths to accept indexOfObject?

Hey. I have a code snippet that looks like this: [tableView beginUpdates]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[array indexOfObject:[array objectAtIndex:indexPath.row]]] withRowAnimation:UITa...

Cocoa NSString explode

Hi all, I have a NSString: @"1a,1b,1c,1d,5c". I want this NSString separated into a NSMutableArray, but I don't know how. I think it is fairly simple but I can't find it (maybe because my English isn't good enough to find a good description for it to search on). Regards, Dodo ...

Removing object from NSMutableArray

Just a small query... I stumbled across the following shortcut in setting up a for loop (shortcut compared to the textbook examples I have been using): for (Item *i in items){ ... } As opposed to the longer format: for (NSInteger i = 0; i < [items count]; i++){ ... } //think that's right If I'm using the shorter version, is there ...

Objective-C : Sorting NSMutableArray containing NSMutableArrays

Hi ! I'm currently using NSMutableArrays in my developments to store some data taken from an HTTP Servlet. Everything is fine since now I have to sort what is in my array. This is what I do : NSMutableArray *array = [[NSMutableArray arrayWithObjects:nil] retain]; [array addObject:[NSArray arrayWithObjects: "Label 1", 1, nil]]; [array...

iPhone/Mac - C++ vector or NSMutableArray

I'm creating an application for iPhone which needs to handle large data. So, I would like to know which one will be better to use : C++ Vectors or ObjectiveC's NSMutableArray? Which one will be faster to access elements, delete elements, add elements etc. Can some one guide me please? ...

How do you filter an NSMutable Array that contains core data?

I have an array that it is populated by core data as follows. NSMutableArray *mutableFetchResults = [CoreDataHelper getObjectsFromContext:@"Spot" :@"Name" :YES :managedObjectContext]; It looks like this in the console. (entity: Spot; id: 0x4b7e580 ; data: { CityToProvince = 0x4b7dbd0 ; Description = "Friend"; Email = "b...