I'm a total noob to iPhone programming, and I've run into an exception being thrown that I just can't wrap my head around.
Background: The error is happening in a custom subview, and occurs immediately upon loading the program. I'm getting an exception thrown in the overridden drawRect method. The code throwing the error follows:
- (vo...
Is it possible to observe (subscribe to) changes to values stored under different keys in an NSMutableDictionary? In my case the keys would already exist when the subscription is initiated, but the values change and I would like to be notified in this case. I would like the key of the changed value in the notification.
I assume that if ...
Is there a more efficient way to add objects to an NSMutable Dictionary than simple iteration?
Example:
// Create the dictionary
NSMutableDictionary *myMutableDictionary = [NSMutableDictionary dictionary];
// Add the entries
[myMutableDictionary setObject:@"Stack Overflow" forKey:@"http://stackoverflow.com"];
[myMutableDictionar...
Everything is working fine until I call the saveFile method (shown below) to write the file back to disk, where it crashes. What am I doing wrong?
This is part of my viewDidLoad method where I open the file, which works fine.
//Get The Path
[self initPath];
dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:accountsFileP...
NSMutableDictionary *bookmarks = [NSMutableDictionary dictionary];
[bookmarks setObject:[NSURL URLWithString:(NSString *) @"http://stanford.edu"] forKey:
@"Stanford University"];
[bookmarks setObject:[NSURL URLWithString:(NSString *) @"http://apple.com"] forKey:
@"Apple"];
[bookmarks setObject:[NSURL URLWithString:(NSString *) @"http://...
Hello all ,
I seem to have a probably newbie problem but here it is.
How do I get my dictionary from my parser class , which has building a tree for a drill down table back to my drilldowntabledelegate class.
my app looks something like this.
@implementation DrillDownAppAppDelegate
@synthesize window;
@synthesize navigationControl...
Hello all,
I have created a NSMutableDictionary with the necessary strings and id 's
it looks a bit like this
Root
| |
Rows
|| -
Item1 (consists of key Exercise and a string:testing + a key ID and a string:OIK74 )
|| -
Item2 (consists of key Exercise and a string:testing3 + a key ID and a string:424RE)
|| - Item3 (cons...
OK, this is driving me nuts -- please tell me I'm not losing my mind!
I declare:
NSMutableDictionary* generalSettingsDict;
im my .h
I init:
generalSettingsDict = [[NSMutableDictionary alloc] initWithCapacity:5];
in a viewWillAppear
I set:
[generalSettingsDict setValue:[NSNumber numberWithBool:control.on]
...
I copied these posts from a forum where I posted recently, but got no reply.
I have the base for my code all setup, it is a drill down table with navigation controller which loads data into a nsmutabledictionary from a plist with some empty values, on purpose. On command the app then downloads information which is then set, setValue, in...
I have the error -[NSCFString stringValue]: unrecognized selector sent to instance 0x1578c when executing this code
I don't understand what I'm doing wrong
name is a NSString
self.searchValues= [[NSMutableArray alloc] init];
name=@"Bob";
if(self.name!=nil)
[searchValues addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys:@"N...
When looking at the documentation, I hardly see any big difference. Both "value" and "object" are of type id, so can be any object. Key is once a string, and in the other case an id. One of them seems to retain the object, and the other don't. What else? Which one is for what case?
...
Hello - I am new to Objective C and am having troubles adding a 2d int array to a NSMutableDictionary. The code errors with "incompatible pointer type" - I assume this is because setObject would be expecting an object..
Here is the code - I am trying to have a Dictionary containing my level data:
NSMutableDictionary *level = [[NSMutabl...
I have an Objective-C class that looks something like:
@interface myClass : NSObject
{
NSMutableDictionary *aDict;
}
Its setter method looks like:
- (void) setADict: (NSMutableDictionary *) newDict
{
[aDict release];
[newDict retain];
aDict = newDict;
}
I've created an instance of the object, put data into aDict, an...
Long time Windows developer, 1st time Objective-C/iPhone developer wants to create a dictionary of arrays that can be displayed in a plain TableView with alphabetic sections.
The source for this dictionary of arrays is an array containing store names sorted alphabetically:
Apple Store
Atlanta Bread Company
Borders
Build-A-Bear Workshop...
I have NSMutableDictionary object say obj. When I write it to the disk using
[obj writeToFile:filename atomically:YES] , the file does not get written to the disk. But the same set of statements work for a smaller mutable dictionary.
The first obj is (nonatomic, retain) property object of a class. The second smaller obj is a temporary ...
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...
Hi everyone,
I'm trying to look through a NSMutableDictionary loaded with an NSMutableArray and I'm messing it up, and I don't know how. I'm trying to load a larger plist of game questions, then delete them if they aren't the right level. I don't get an error until I try and delete. Can anyone see the flaw in this code? I'd super ap...
Hey all,
So, in my iPhone app I was using integers to keep track of a lot of variables. I declared and initialized them all in my AppDelegate file (it's a multiview app), and then if I declared them in the other views (classes) and the values would stay the same. In this way, I could set Money = 200 in the App Delegate file, and then ...
I am developing an application in which i want to use an NSDictionary. Can anyone please send me a sample code explaining the procedure how to use an NSDictionary to store Data with a perfect example?
...
Could someone please clarify for me the semantic difference between these two:
self.foo = [NSMutableDictionary dictionaryWithCapacity:theCapacity];
self.foo = [[[NSMutableDictionary alloc] initWithCapacity:theCapacity] autorelease];
Are the interchangable? If not how exactly do they differ.
Thanks in advance.
Cheers,
Doug
...