nsarray

color array handling with openGL

Hi guys I am developing an ipad app with openGL. In my app basically I am drawing a basic shape i.e 3d cube, which can rotate according to user's finger motion. Now I am stuck on coloring part of this cube. I want user to choose surfaces of his choice to color this shape. So what I am trying to do is...I am changing the array for glCol...

sort elements of a table view in sections

in my app I have a table view where I download a list of hotels parsed by an XML(for every hotel i put in xml an attribute STARS); I need to view hotels by stars (from 5 stars to three stars), dividing it into three sections. So I have a section "5 stars" where there are 5-star hotel, a section "4 stars" where there are the 4-star hotel ...

Sorting an NSArray by an NSDictionary value

I'm trying to sort an array that would look something like this: (please ignore the fact these people are well past any living age! I just needed large numbers) NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"sam",@"name",@"28.00",@"age",nil]; NSDictionary *person2 = [NSDictionary dictionaryWithObjectsAndKeys:@"cody...

Match NSString with image file names in loop

I have the following method: -(UIImage *)flagFromOrigin:(NSString *)originString { NSRange range; for (NSString *arrayString in countryArray) { range = [[originString lowercaseString] rangeOfString:arrayString]; if (range.location != NSNotFound) { return [UIImage imageNamed:[NSStri...

accessing Objective-C nested array element

I have an array initialized - (void) viewDidLoad { NSArray *myArray = [NSArray arrayWithObjects: [NSArray arrayWithObjects:@"item 1-1", @"item 1-2", nil], [NSArray arrayWithObjects:@"item 2-1", @"item 2-2", nil], [NSArray arrayWithObjects:@"item 3-1", @"item 3-2", nil], ...

Objective C - NSArray and For loop structure

Hi everyone, Work got in the way of learning Objective C but i'm back at it now and this has been driving me crazy. This is my code: i=0; for (i=0;[photoList count]; i++) { NSLog(@"%i",i); NSLog(@"%@",[photoList objectAtIndex:i]); NSString *fileName = [photoList objectAtIndex:i]; sendImage = [UIImag...

How to refresh UITableView data?

I have a UITableView with two sections, which are both empty when my application launches. My app fetches the data from a URL, then puts the data into arrays (one per section) which should be used to supply the UITableView data for each cell. Calling [tableView reloadData] doesn't seem to refresh any of the data, or call any of the dele...

multi-section UITableView issues

Hi, I have an UITableView that contains 3 NSArrays and 3 NSDictionaries for each array. - (void)viewDidLoad { [super viewDidLoad]; contentArray = [[NSMutableArray alloc] init]; self.settingsArray = [NSArray arrayWithObjects:@"Settings", nil]; NSDictionary *settingsDict = [NSDictionary dictionaryWithObject:settings...

Obj-C / iPhone: NSArray question

Hello, I have an array that looks like this when printed via NSLog: { response = "Valid"; updates = ( { string = "test"; integer = 3493; }, { string = "test2"; integer = 55454; } ); start-index = 0; My question is how I can loop through through the "upda...

Help w/ array of dictionaries in a tableview

This is kinda confusing so please bear with me. I have an array (listOfStates) of dictionaries. Where listOfStates has this structure: {stateName} - {stateCapital} {Alabama} - {Montgomery} {Alaska} - {Juneau} {Arizona} - {Phoenix} ... {West Virginia} - {Charleston} {Wisconsin} - {Madison} {Wyoming} - {Cheyenne} This is the code used ...

Objective-C Storing Information

Hello, in an iPhone app, the User can create Items - each Item needs to have a CGPoint, NSString and a few integers with information about it. The User can keep adding these Items. How can i store all these variables for each of the Items and programmatically keep adding them to a list or array or something? I tried using a struct arr...

sort NSArray of UIImagerview?

Hi all, i want to sort NSArray of UIImageView according their frame? i try for NSSortDescriptor but when i write key=@"frame" unrecognized selector error occur. please tell me how to sort my array. thanks in advance. ...

Insert NSDictionary

hi, I have a question. If i have a NSArray i can put into a NSDictionary? If i can, how can do these? Thanks ...

Help Sorting NSArray

In my project I roll through a bunch of sql records and populate a NSMutableDictionary with a string for each key. The keys are important because I use them as section titles in my TableView. The problem I have is that I would like the sections in a certain order. When I call allKeys the order of the keys isn't the same as the order the...

How to save array to NSUserDefaults?

I would like to save an array of view controllers in NSUserDefaults, but I am not sure how: [[NSUserDefaults standardUserDefaults] setObject:tabBarController.viewControllers forKey:@"tabOrder"]; When I read the above line, my tabBarController.viewControllers is blank. ...

How To Extract Information from NSArray Generated from Core Data NSPredicate?

Hi, I am using Core Data to develop an application, and I have used a NSPredicate to 'query' an entity which returns an NSArray of results, as is standard. The NSArray contains objects of 'EntityA' which itself contains attributes 'AttributeA' and 'AttributeB'. My question is, how can I extract information from this array? Furthermor...

Copying Multi-Dimensional NSMutableArray

I'm currently working on a Sudoku application, the numbers are stored within a Multi-Dimensional NSMutableArray of NSNumbers. I keep an array in my SudokuGridView, for displaying the numbers in the grid. When it comes time to solve the puzzle, I pass a [grid numberGrid] to a subclass of NSOperation I've created that solves the puzzle. T...

How to construct IBOutlet names in code in order to change them?

Let's say I've got several UILabels which have been set up in IB and connected to IBOulets in code (label1, label2, label3, label4) How would I create these variable names within code, so that I could change the text of each one in a loop, where the labels are taken from a NSArray. Here's the pseudo-code: labelArray = [NSArray arrayWi...

How to sort a NSArray randomly?

Let's say I have a NSArray with 50-100 objects inside. How can I sort the array into a random order? ...

Searching NSArray for an object

I have NSArray consisting of NSDictionary objects. Need to find index in NSArray of object with matching key name in NSDictionary. Dictionary has only 1 element. What is the fastest way of doing that? Filter with predicate and then use indexOfObject? ...