nsarray

what does -arrayWithArray actually DO?

I want to see EXACTLY how it creates an array. How can I view the .m files that show how it's done? ...

Convert NSArray to NSDictionary

How can I convert an NSArray to an NSDictionary, using an int field of the array's objects as key for the NSDictionary? ...

NSArray becomes NSCFArray when passed

I have a method that receives many different kinds of objects and decides what to do with them: -(void)performAction:(NSObject *)myAction withItem:(Item *)myItem { actionCount = -1; NSLog(@"-- NEW ACTION ARRAY --"); if ([myAction isMemberOfClass:[Look class]]) { currentActionArray = [self createLookArray:(Look *)myAction item:myItem];...

iPhone - getting unique values from NSArray object

I have an NSArray formed with objects of a custom class. The class has 3 (city, state, zip) string properties. I would like to get all unique state values from the array. I did read through the NSPredicate class but couldn't make much of how to use it in this case. The only examples I could find were for string operations. Can someone ...

Need help with adding a row to a table

I am new to objective-C and I'm having a lot of trouble trying to add new rows to a table. The way it is suppose to work is, when the app loads an alert pops up asking the user if they would like to, start a new configuration, load a saved configuration, or resume the last configuration. Now if they select start a new configuration, th...

Filter NSArray iphone

Hi, I use coredata to fill an array with data that is displayed in a tableview. In the tableview, I have two section. When a cell is pushed in section1, I want that cell to be moved to section2, and the other way around. Im not quite sure how to accomplish this, and I been sitting trying to figure it out for about 8 hours now. Th...

Objective C: How do I substring an email address in text field to firstpart separated by @

Hi guys, I have been scratching my head trying to find any resources on substringing an email address I get from a textfield into getting the first part before the @ symbol. Ive tried looking at the documentation, playing around with the componentsseparatedbyString. No luck. Thanks for your help in advance ...

iphone sdk - UITableView - cannot assign a table to the table view

hello, this is a part of my code. My application crashes when i try to load the view including the uitableview. i think there's a problem with the table i'm tryin to use but can't find it. help please gameTimingTable=[NSArray arrayWithObjects:@"2min + 10sec/coup",@"1min + 15sec/coup",@"5min",nil]; declared in .h as NSArray *game...

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...

Works with number of string contained in NSArray

Hi, I need to pick string valur from an NSMutableArray then save it into a plist. I've builded an NSMutableArray to display infos in table View. Maximum allowed index is 8. (paste just two in example) The problem if the String doesn't exist, I get the following error: sDict is a dictionary for saving datas to a property list file. th...

disordered/ordered context fetching

Hello to everyone, I cannot understanding why values assign to array objects become "disordered" after executing executeFetchRequest. Well, I'm not certain that fetching is the problem here. Here's the code. objects=[NSArray arrayWithObjects:@"a",@"b",@"c",@"d",@"e",nil]; NSManagedObject *DB = nil; for (int i=0;i<[objects count];i+...

Use NSArray to to specify otherButtonTitles?

UIAlertSheet's constructor takes an otherButtonTitles parameter as a varg list. I'd like to specify the other button titles from an NSArray instead. Is this possible? i.e. I have to do this: id alert = [[UIActionSheet alloc] initWithTitle: titleString delegate: self ca...

Using NSArray's makeObjectsPerformSelector to have side effects

I have an NSArray of Foos in an Objective-C program. I would like to call the doIt function of each Foo, however, the makeObjectsPerformSelector function of NSArray does not allow the original Foos to be modified, per the docs. The doIt selector changes the m data member for each Foo when doIt is called. How do I go about efficiently per...

How can I filter an array based on the objects in another array in Objective-C?

I have an array of objects in a tableView. I want the user to be able to go to another page and select from a checklist of objects to filter the first array. How should I handle the data from the checklist? I am currently handling it as an NSMutableArray of selected objects. But then how do I filter the first array with the contents of ...

Beginner: Why do I get a EXC BAD ACCESS?

I am geting an exception while hitting the line "self.myData = ..." GDB Program received signal: EXC_BAD_ACCESS Here's my code: - (void)viewDidLoad { [super viewDidLoad]; self.myData = [NSArray arrayWithObjects: [NSArray arrayWithObjects: @"Boroughs", [NSArray arrayWithObjects: @"Kings...

Extract or show some dictionaries for sequenced TableView

In a Tabbar app, I have a TableView to show all names of each dictionary of an array coming from an array like this : <array> <dict> <key>Name</key> <string>Name1</string> <key>CategoryA</key> <string>CategoryA1</string> <key>CategoryB</key> <string>CategoryB4</string> <key>CategoryC</key> <string>CategoryC8</string> </dict> <di...

sorting in nsmutable array

Suppose I have following data in my game. I have developed game in cocos2d. Name Score Sagar 10000 Amit 2000 Vishal 90 Above data is stored in plist file. Plist has an array as root. Within that there are 10 dictionary. Each dictionary has two values. String values - Name Number value - score When I use NSMutableArray...

Silly NSArray question

I can't believe I forgot this, what is in an NSArray if there's no value in the field (this is being determined by loading a .plist file). I know I should know this, but right now I'm having a serious brain fart ...

iphone sdk see size of local file (one created by application)

Is there anyway I can look at the size of a file the application creates in bytes then store that number to use later? OR is there any way I can tell if an object in an NSArray is empty, I've tried everything, but it just doesn't work! ...