nsmutablearray

Use of nested references in objective C

Getting an error message "Nested functions are disabled, use -fnested" etc in XCode/ObjC. Here's the code (balls is an NSMutableArray pointing at a bunch of UIViews). CGPoint pos=[[self.balls objectAtIndex:pointidx] center]; But the following seems to compile ok. UIView *ref=[self.balls objectAtIndex:pointidx]; CGPoint pos=ref.cent...

numberOfRowsInSection did not return mutable array length

hi I am new to iphone development. numberOfRowsInSection method of UITableViewController executed before parsing the XML node so that this method return value as zero, but this method should be return value of number of rows with data. please help me thanks. ...

Dereference (release?) NSMutableArray

Hi Guys, in my class i have a NSMutableArray declared and used. One of the methods of this class however needs to clear the entire array and add new set of objects into it. What would be the best approach to clear it out and add new objects to it from scratch? regards peter ...

What's the best way to store and retrieve multi-dimensional NSMutableArrays?

I'm storing a bunch of data in a .plist file (in the application documents folder), and it's structured like this: Dictionary { "description" = "String Value", "sections" = Array ( Array ( Number, ... Number ), Array ( Number, ... Num...

how to check repetition of numbers in an array?

I generate random numbers and store them in an array. int RandomNumber = arc4random() % 12; [NSMutablearray *Number addObject:[NSNumber numberWithInt:RandomNumber]]; Now i want to make sure the same number is not created randomly again. Can any one please tell me how to do it with sample code. ...

iPhone Obj C -- Sorting a Mutable Array of dictionaries -- display a string but sort by value

I have a NSMutableArray with 30 dictionaries inside of it. Each contains a name and a value. I currently have the names sorted so that the show in a table view alphabetically. However, I'd like to make a UIButton to give the option of STILL DISPLAYING THE NAMES, but ordered by the value. The value doesn't need to be displayed. Also, whe...

Objective-C NSMutableArray releasing / destruction

The following code in my function (run in a loop) is causing my program to use more and more memory until it crashes. What am I doing wrong? - (void) processTrackValues:(NSMutableArray*) tags { NSImage* trackArt = [tags objectAtIndex:5]; NSMutableArray* tempArtArray = [[NSMutableArray alloc] init]; [tempArtArray addObj...

iPhone Application Exit when scrolling the UITableView

I have declared a NSMutableArray and I populated it with information from the database. The table displays information well. But when I scroll down, the application exits. Seems like its loosing the pointer to the array. Here is the code for declaration of the array: @interface RootViewController : UITableViewController <CLLocationMana...

How do I store an NSMutableArray to Disk on an iPhone app for later retrieval?

How do I store an NSMutableArray to Disk on an iPhone app for later retrieval? ...

NSArray to NSMutableArray as random stack

Just a conceptual description first: I am reading input from a text file (a list of words) and putting these words into an NSArray using componentsSeparatedByString method. This works. But I wanted to select the words randomly and then delete them from the array so as to ensure a different word each time. Of course, you cannot change...

sortUsingSelector Not Sorting an NSStrings Array

This is confusing to me. I have a function that does this: void ListAllStoredLocations(NSString *SearchTerm){ NSMutableDictionary *item; NSString* filePath = [[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingString:@"/Preferences/yourprogram.plist"]; item = [[[NSMutab...

NSmutable array returns null in subviewcontroller: iphone objective C

Hi, I have a root view controller that I'm adding a subviewcontroller to. Rootviewcontroller: I'm trying to add a value from a dictionary as the sole member of the moviewController.list NSMutableArray. However its not getting added and the NSlog is telling me that the "list: (null)" for (id key in dictionary) { MovieController *m...

Why does NSMutableArray Count crash my app?

I've ran into a problem. Everytime I'am starting my app it crashes. Heres me code. The Debugger Says: [list count] crashes the app. I have no idea. NSLog(@"%@", self.list); gives me one item as expected... if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { data = [[NSData alloc] initWithContentsOfFile:filePath]; unarc...

NSMutableArray of Objects Returning Type UICGColor during cellForRowAtIndexPath Event

Hi everyone I'm pretty new to Objective C and iPhone development and have hit a problem which has completely stumped me I have a class, Sale, which has the following class method: +(NSMutableArray*)liveSales { NSMutableArray *liveSales = [[NSMutableArray alloc] init]; for(int i = 0; i <= 100; i++) { Sale *s = [[Sale alloc] init];...

Syntax question on accessing properties of objects stored in a NSMutableArray

Could someone explain why the second syntax of the same expression does not work? If you need some background, manyViews is a pointer to an NSMutableArray loaded with UIView objects. [[manyViews objectAtIndex:0] setFrame:CGRectMake(30,30,100,20)]; // works as intended [manyViews objectAtIndex:0].frame = CGRectMake(30,30,100,20); ...

releasing View Controller which are in Dictionary - in objective c

Hello ! Every on here. I was just confusing a little bit for the following issue. I have coding in my project as follow. I am adding view controllers' view to the each cell of table view. let me explain how... An array, like these NSMutableArray *arrTbl=[[NSMutableArray alloc] init]; NSMutableDictionary *dOne=[[NSMutableDictionary a...

Performance issues with NSMutableArray and NSArray

I've been programming C/C++ for 20 years but I'm new to objective-c and Coco and have some questions about the performance of NSMutableArray and NSArray. I need an container much like the stl list container, but coco doesn't seem to have one and inserting and removing elements from the middle of MSMutableArray seems slow, but treating ...

iPhone Core Data objects added to NSMutableArray

I am trying to have a bunch of Core Data objects (NSStrings) be added to an NSMutableArray so that I pickerView can use the strings as its data values. Currently I am able to save strings from a textField one at a time into the sqlite file, in Core Data. I am having trouble pulling those Objects back out of the Core Data sqlite file an...

How do I Increase the speed of this sqlite db query / object creation in Objective-C?

Hi, I have the following method which queries a sqlite db table on the iPhone it pulls about 6,000 rows from the table and then cycles through those creating 6,000 objects based on the information and stuffing them into an array. The while loop is somewhat slow (takes ~ 10 seconds to iterate through them on my device) Any thoughts on ho...

Is there anyway to populate a UITableView with an array but persist checkmarks?

Hello all, I have an app that has a tab bar, each tab contains a separate table. The first table uses core data to persist its entries and checkmarks. The second table on the second tab uses an NSMutableArray to populate it (I would use core data but I would have to pre populate it and this table does not allow that) I would like to per...