Questions tagged [nsmutablearray]

NSMutableArray represents a modifiable (mutable) array object for Cocoa and Cocoa Touch. It is Available in OS X v10.0 and later

NSMutableArray represents a modifiable (mutable) array object for Cocoa and Cocoa Touch. Its immutable variant is NSArray (), which is more efficient for memory and thread-safe than the mutable variant.

NSMutableArray represents a modifiable (mutable) array object for Cocoa and Cocoa Touch.

The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects and “toll-free bridged” with its Core Foundation.

The reason to subclass NSMutableArray from NSArray is this class does well what it is designed to do—maintain a mutable, ordered collection of objects. But there are situations where a custom NSArray object might come in handy.

Resources:

Question on NSMutableArray:

1.objective C: use NSMutableArray in different classes

2.How to sort an NSMutableArray with custom objects in it?

3.How do I convert NSMutableArray to NSArray?

Examples:

Creating Mutable Arrays

5318 questions
1
vote
1 answer

Concatenating of two arrays results in null

I am trying to concat two directory listings into one array, I get the directory arrays to show the list of files in each separately (NSLog), but concatenating them together via addObjectsFromArray, results in (null): NSString *path1 =…
Jeremiah Smith
  • 738
  • 6
  • 17
1
vote
2 answers

I can't figure this crash out: [__NSArrayM insertObject:atIndex:]: object cannot be nil

I am having the [__NSArrayM insertObject:atIndex:]: object cannot be nil crash when I test the app on my device, but not on the iOS simulator. Here's what going on: I am managing 5 UITextField on a View Controller, then I am passing the text of each…
esierr1
  • 117
  • 3
  • 12
1
vote
1 answer

How to persist an MSMutableArray in Core Data?

I use Core Data and fetch objects into a NSMutableArray: NSError *error; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Item"…
ZviBar
  • 8,148
  • 5
  • 21
  • 30
1
vote
2 answers

Objective-C: How to get properties of an object inside NSMutableArray?

I have this NSMutableArray of UIImage named camImages. Then I want to get the scale property of an image, but I can't seem to access that using [[camImages objectAtIndex:i] scale] //doesn't return the desired scale…
yonasstephen
  • 2,546
  • 3
  • 20
  • 46
1
vote
1 answer

Stack implementation in Objective-C

I am implementing a stack in Objective-C, when I'm testing my class, I get invalid results. Here are the codes: Classes/Stack.h: #import #define DEFAULT_SIZE 16 @interface Stack : NSObject { @private int size; …
hakuna matata
  • 2,831
  • 11
  • 46
  • 85
1
vote
2 answers

Eliminate duplicate profiles from XML file iOS

I am creating an app that loads an XML file with a list of profiles from the web. There is a button that shows all the profiles in a textView when pressed. Now I want to have another button to remove duplicate profiles from that list on the…
azi_santos
  • 105
  • 12
1
vote
1 answer

Refreshing and updating objects in a NSMutableA​rray from Parse

I have an app where the user signup and every time they finish a level it is sent to Parse. Its all working great so far. Now when a user wants to add a friend, they type in their email and it adds their name to a NSMutableArray and their score to a…
user3140511
  • 47
  • 1
  • 5
1
vote
3 answers

Array, not refeshing table view

I have a list of items, and in a modal view controller, i have what is effectively a 'New item' screen, where a user can type in a new thing for the list. The list is a UITableView, with data source, NSMutableArray. here is the code on the…
Sam Jarman
  • 7,025
  • 14
  • 49
  • 98
1
vote
3 answers

Removing NSString form NSMutableArray

I have an array with 3 strings that all equal "Farm" When I try to remove ONLY ONE "Farm" with this line of code: [array removeObject:@"Farm"]; It removes all. How can I only remove one?
Abdullah Shafique
  • 6,780
  • 7
  • 30
  • 68
1
vote
4 answers

Storing NSMutableArray to NSUserDefaults

First of all: Merry Christmas everyone! It has been some time since I was able to store data into NSUserDefaults. In this case I want to store a NSMutableArray to the NSUserDefaults. It is clear to me that you can only store immutable objects to…
Alex van Rijs
  • 793
  • 4
  • 15
  • 36
1
vote
1 answer

incompatible pointer types assigning to NsObject from NSMutablearray in iOS7 warning

Please Any one guide e how to rectify the warning, I'm getting "incompatible pointer types assigning to nsobject from nsmutablearray" in iOS7 warning but in iOS6 its working fine. Here I'm using like this, NSObjectRef = [NSMutableArray…
Laxmi
  • 132
  • 1
  • 3
  • 12
1
vote
3 answers

NSMutableString to NSMutableArray

I have a NSMutableString with a bunch of floating point numbers. I need to convert them to NSMutableArray but in groups of 3: 0.015637 0.0205293 0.0270841 0.0157598 0.0202236 0.0272967 0.013217 0.0205293 0.0283439 0.0115028 0.0205293 0.0290539…
Julian
  • 9
  • 6
1
vote
5 answers

iPhone - array lost between appDidBecomeActive: and run loop starting?

EDIT: I stuck in a single call to manually retain the array right after initializing it, and that fixed it. Dur. Thanks. I keep an NSMutableArray in a UIScrollView subclass, and I add to it instances of a UIImageView subclass as each is added as a…
Dan R.
  • 13
  • 1
  • 4
1
vote
0 answers

Sudoku Function returning array of identical boards

I am writing a recursive Sudoku solver and I am having some issues with 2D array handling. I included the function which is giving the trouble. There are some unnecessary lines I was using for debugging in there. - (Stack *)successors { Stack…
1
vote
2 answers

How do I save an NSMutableArray w/ UIImgeViews to the iPhone's document direcory

I have an NSMutableArray that holds multiple and changing amounts (that's why I am using an NSMutableArray) of UIImageView's that I want to save and also in return load when my app quits and loads. Also, how would I then, after my app loads, get the…
Jab
  • 21,612
  • 20
  • 66
  • 111
1 2 3
99
100