nsdictionary

How to retrive user input data entered tab bar View Controller when application start in iphone app

Hello, I have created window based application. Tab bar controller as root controller and it has three tabs. One Tab has Labels and TextFiled inputs like Name, Username and Password. I am looking to store this text filed inputs when user enters and able retrieve in other tabs. Previously I have set key for different text fields and se...

NSMutableDictionary is being treated as an NSDictionary

Hi, I have a simple class with an NSMutableDictionary member variable. However, when I call setObject:forKey I get an error ('mutating method sent to immutable object'). The source of the problem is obvious from the debugger -- my NSMutableDictionary is actually of type NSDictionary. I must be missing something incredibly simple but c...

How can get the values of NSDictionary using keys where the dictionaries are stored in NSArray ?

I have created 5 NSDictionary's. I stored them in NSArray. I need to get the values stored in NSDictionaries. How can do it ? I tried calling [[array objectAtIndex:i]objectForKey:key1]. But, it is crashing by giving the message:unrecognized selector sent to instance How to get the data ? NSDictionary *enemy1, *enemy2; NSArray *enemyDat...

How to create Dictionary object in AppDelegate to access objectkey in another ViewController

Hello, I have created Window Based application and tab bar controller as root controller. My objective is to store Text Field data values in one tab bar VC and will be accessible and editable by other VC and also retrievable when application start. I am looking to use NSDictionary class in AppDelegate so that I can access stroed Data V...

Constant NSDictionary/NSArray for class methods.

I am trying to code a global lookup table of sorts. I have game data that is stored in character/string format in a plist, but which needs to be in integer/id format when it is loaded. For instance, in the level data file, a "p" means player. In the game code a player is represented as the integer 1. This let's me do some bitwise ope...

Storing imageView in NSDictionary iphone sdk

Hi all, I'm my application I want to pass an UIImageView to NSDictionary. Can anybody please help. It's urgent. Thanks in advance. ...

Can NSDictionary be used with TableView on iPhone?

In a UITableViewController subclass, there are some methods that need to be implemented in order to load the data and handle the row selection event: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; //there is only one section needed for my table view } - (NSInteger)tableView:(UITableView *)tableView nu...

NSDictionary with key => String and Value => c-Style array

I need an NSDictionary which has key in the form of string (@"key1", @"key2") and value in the form of a C-style two-dimensional array (valueArray1,valueArray2) where valueArray1 is defined as : int valueArray1[8][3] = { {25,10,65},{50,30,75},{60,45,80},{75,60,10}, {10,70,80},{90,30,80},{20,15,90},{20,20,15} ...

What would cause objectForKey: to return null with a valid string in place?

I am having an issue with NSDictionary returning null for an NSString even though the string is in the dictionary. Here is the code: - (void)sourceDidChange:(NSNotification *)aNote { NSDictionary *aDict = [aNote userInfo]; DLog(@"%@", aDict); NSString *newSourceString = [aDict objectForKey:@"newSource"]; DLog(@"%@", newS...

App crashes when using international characters in NSDictionary

I am listing out data to a UITableView from a plist file where I have a two dimensional array/dictionary: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; <plist version="1.0"> <array> <dict> <key>ID</key> <integer>1</inte...

extract data from Plist to array and dictionary

Hi I made a plist that looks like that: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList 1.0.dtd"> <plist version="1.0"> <array> <array> <dict> <key>Company</key> <string>xxx</string> <key>Title</key> <string>VP Marketi...

Using NSDictionary throughout an iphone project

Hi guys, How do you access a NSDictionary in different NSViewControllers. The NSDictionary was initialized in my delegate file. Do I have to import my delegate file to each view controller file or do all my views on top of my delegate know of my NSDictionary? Do I possibly need to declare my Dictionary in each file? -Thanks Guy ...

Avoiding sorting in NSDictionary

I was using NSDictionary and i observed that the objects in the dictionary are sorted automatically with respect to the keys, so my question is how to avoid this sorting , any flag available to set it off, so i get the object in same order i entered. i know u may be thinking what difference it makes in dictionary since we retrieve the v...

How do I rewrite a plist if its data types are immutable?

I am getting comfortable with using plists for initializing my app. I now want to save app state back to the plist used to initialize the app and I find myself stuck. At application startup I ingest the plist into an NSDictionary which is immutable. I now want to update the NSDictionary by replacing old values with new values for existin...

How can I get the first element in an NSDictionary?

I have an array of NSDictionaries. How can I pull out the first element in the dictionary? NSArray *messages = [[results objectForKey:@"messages"] valueForKey:@"message"]; for (NSDictionary *message in messages) { STObject *mySTObject = [[STObject alloc] init]; mySTObject.stID = [message valueForKey:@...

NSTimer to smooth out playback position

I have an audio player and I want to show the current time of the the playback. I'm using a custom play class. The app downloads the mp3 to a file then plays from the file when 5% has been downloaded. I have a progress view update as the file plays and update a label on each call to the progress view. However, this is jerky... someti...

NSDictionary, NSArray, NSSet and efficiency

Hi, I've got a text file, with about 200,000 lines. Each line represents an object with multiple properties. I only search through one of the properties (the unique ID) of the objects. If the unique ID I'm looking for is the same as the current object's unique ID, I'm gonna read the rest of the object's values. Right now, each time I s...

NSDictionary with specific property of plist

Hi, I have a plist with key values. Each key represent a language, let's say 'it' 'en' ....ecc The value of each key is another key/value(=array) set. At startup I would like to create a dictionary by reading only a specific key. Let's say the locale of my iphone is 'it', then the init method would only parse it key, because the only w...

Trouble getting NSString from NSDictionary key into UILabel

I'm attempting to put the value associated with the key called "duration" into a UILabel but I'm getting a blank or "(null)" result showing up in the UILabel. My NSDictionary object with its keys seems to be logging as being full of the data and keys I think I want, as such: the content of thisRecordingsStats is { "12:48:25...

generating an objectForKey from an array

I'm having success when I use this code to get a string from an array of file names called "fileList": cell.timeBeganLabel.text = [[[self.fileList objectAtIndex:[indexPath row]] lastPathComponent] stringByDeletingPathExtension]; so I expected the same code to generate the same string as a key for me in this: NSDictionary *stats = [th...