nsarray

How to get Soundfilenames from an NSArray and play?

Hello, I want to play several audiofiles (*.wav) by touching the appropriate UImageViews. Each touching an UIImageView changes an "triggernumber" - wich view is selected. The audiofile names are stored in an array. But I can't figure out how to write a method to get the names and play the right sounds without using a select case method w...

How to avoid userinput while playing a soundloop complete

Hello, I have some UIImageViews (Animals) and by touching them a specific soundloop starts to play. But if the user touches twice or more on the same View, the apropriate soundloop starts over and over again with an overlap. I wanna have that the touched sound is played once until its end and than the user can start the next time. The du...

(null) values in NSMutableArray after inserting an NSMutableDictionary

I'm using an NSXMLParser to grab data and build an array of dictionaries with some information on a set of photos. Whenever I attempt to add a dictionary to the array, the value is always (null) Code: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSStr...

Array is empty after function

Hello everyone, I am newbie with Cocoa Touch, I have a problem that I try to figure out. I will appreciate if anyone could help. I would like to create a tableDataList to display on the table. AsyncViewController will call TableHandler fillList method to initialize table data. But after fillList call, the tableDataList return empty. C...

NSArray randomly turning into different things!

I am having a problem with memory management I think. My NSArray (called arr) is turning into different things at random times. I have no idea why. I have a .h file that that declares the array, and then I initialize the array using NSString *input = [[NSString alloc] initWithData:myData encoding:NSACIIStringEncoding]; arr = [input com...

Challenge: How to turn an NSArray of numbers into an English-readable list

Hi all, I'm looking for a nice clean routine for turning an NSArray containing NSNumbers (integers) into a nice English-readable string. For example, I want to change this: [NSArray arrayWithObjects:[NSNumber numberWithInt:5], [NSNumber numberWithInt:7], [NSNumber numberWithInt:12], ...

NSArray Problem

Hi, i try to generate 6 random numbers and put them in a global NSArray, thats what i have done: in MainViewController.h NSArray * zufallsZahlen; i have function to generate the Numbers: - (NSArray *)generateNumbers { NSMutableSet *s = [NSMutableSet set]; while([s count] < 6) { NSNumber *z = [NSNumber numberWithUnsignedInteg...

Key Value Observing with an NSArray

I've looked on SO for examples of using Key Value Observing with an NSArray (or NSMutableArray) and apparently you need to use an NSArrayController (which unlike KVO I'm not familiar with), but I haven't found concrete examples of how to do this... can anyone explain with some sample code? For instance, if I have a GameModel which repre...

copy NSMutableArray item

I am copying a mutable array like this: //copy players' info into playerList from a dictionary playerList = [[NSMutableArray alloc] initWithArray:[params objectForKey:@"p"] copyItems:YES]; The items in the array implement copyWithZone like this: - (id)copyWithZone:(NSZone *)zone { PlayerInfo* copy = [[[self class] allocWithZone:zo...

What is my CoreData fetch request actually returning?

I'm fetching some objects out of a data store but the results aren't what I'm expecting. I'm new to CoreData but I'm fairly certain this should work. What am I missing? Note that User is a valid managed object and that I include its header file in this code, and that UserID is a valid property of that class. NSFetchRequest *request...

how to ask an array if an object is contained?

how can i ask an array if it contains an item and if it does it to [[NSArray alloc] initWithObjects:@"those objects" automatically. this is my fav .h @interface FavoriteViewController : UITableViewController { NSMutableArray *favoritesArray; NSMutableArray *didContain; } @property (nonatomic, retain) NSMutableArray *favoritesArr...

Nested NSArray/NSDictionary Problem

I have an NSArray containing several NSDictionaries. I have an NSString containing an ID string. What I'm trying to do is iterate through the NSDictionaries until I find the object that matches the NSString. Then I want to return the entire NSDictionary. I'm fairly new to iPhone development, so I'm probably missing something obvious.....

Hiding an NSArray - how do I do it?

I've got an NSArray setup in my code to display two PNG's alternately flashing, I'm trying to setup a piece of code that sets it to a hidden status, moves it off screen, anything to get it out of sight of the user. The code for my array is NSArray *imageArray = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"CONNECTED dark ye...

checking if an array doesnt contain a certain object

is there a class available to check if an array doesnt contain an object? i want to do something like if [(myarray doesntContain @"object")] is this possible thanks ...

2-dimensional arrays in Objective-C?

I'm working on a basic iPhone game that requires a single-screen tilemap. Nothing difficult there. I come from a C background, so my current solution looks a bit like this: typedef struct _Tile { NSString *type; } Tile; @interface Map { Tile mapData[MAP_TILE_MAX_X][MAP_TILE_MAX_Y]; } This works fine, but I'm wondering if ther...

How to find object of certain kind in an NSArray?

My first instinct is to FooType *myFoo = nil; for (id obj in myArray) { if ( [obj isKindOfClass:[FooType class]] ) myFoo = obj; } With all the goodies in Objective-C and NSArray, there's gotta be a better way, right? ...

How to use containsObject in NSMutableArray

Hi everyone, I am trying to find if there is any object in the mutable array that matches with the object I pass. Please see the function below. The name comes from table view controller, so the row that is tapped is saved into name and passed to this function. I am trying to check whether the name in the table view controller equals t...

NSString and UTF8 Hex Conversion

In this function, I get the selected emoticon from NSTableView from the NSArrayController connected to an IBOutlet called emotes. The string in the selected NSArray contains UTF8 characters that is sent to the clipboard. // Get Selected Emoticon NSArray * selectedemote = [emotes selectedObjects]; NSLog(@"%@",[selectedemote valueForKey:@...

UIImage - How dow I keep track of an index?

Hi I have started creating a simple product image carousel. It basically comprises of 3 visible UIImageViews' and 2 hidden UIImateViews'. The UIImageViews are populated with images from an array and animate to give the appearance of of a carousel. My next objective is to determine which product the user taps and push a detail view onto...

Arbitrary Attributes in Core Data

In short, I want to associate arbitrary key/value pairs with the objects of a Core Data entity, on an iPad app. My current solution is to have a to-many relationship with another entity that represents a single pair. In my application, I have: Entry <--->> ExtraAttribute where ExtraAttribute has properties key and value, and the key ...