I'm trying to store data in the following fashion with a string as the key and I would like an array as the value.
key objects
"letters" {'a','b','c','d'}
"numbers" {1,2,3,4,5,6,7}
Is this possible with NSDictionary in code? If so how would that look like? I'm really confused on this.
...
Hi all,
I'm trying to make a class that handles some NSURLConnection and authentication stuff and then makes a callback to downloadFinished when it has completed the didReceiveData event. How exactly does that work in Objective-C? Thanks!
#import "fetch.h"
...
- (IBAction)downloadButton {
fetch *downloader = [[fetch alloc] in...
So I have the following code:
NSURL *baseURL = [NSURL URLWithString:@"http://www.baseurltoanxmlpage.com"];
NSURL *url = [NSURL URLWithString: @"page.php" relativeToURL:baseURL];
NSArray *array = [NSArray arrayWithContentsOfURL:url];
If the XML page is as follows:
<array><dict><key>City</key><string>Montreal</string></dict></array>
...
I have an webView in a Cocoa application which I edit the contents programatically. What I wanted to do was make clicked links open in the users default browser, so I added the code at the bottom of this question. It works perfectly but if there is an iFrame on the page that loads it will open the iFrame contents in the default browser a...
I've written an Objective-C class and I'm using a shared instance of it across several of the views in my iPhone project. Its member variables include bools, ints, NSStrings and one NSNumber. The shared instance seems to work just fine across the scope of my application, except for the NSNumber which the debugger tells me is "out of scop...
Hello there, it seems I've been searching for a long time and haven't found a great, easy, answer to my problem.
I'm using XCode with Cocoa/ObjC and am trying to create an NSTableView which will load values from an NSDictionary/Array into different sections of a cell.
For example, I'm trying to get an NSImage, NSTextField and other ite...
I have an outline view with 2 entities being displayed inside it so It is connected to a NSTreeController. I have created a button and binded it to the NSTreeController's Controller Key 'canRemove' under Availability>Enabled. But when you run the App the button is always Disabled even when a row is selected in the Outline View. How can t...
Here's a simplification:
I have an application with several buttons. If it is the first time the application is launching, I want to do some special things. In my AppController class, which is a delegate of NSApp, I use the delegate method -applicationDidFinishLaunching: to perform the test. After I've detected that it is the first t...
I think the title is pretty clear. I have ran into this twice now.
The first time it indicated a problem, and my project wouldn't compile.
The second time everything still worked.
Is it just a fluke if my code still builds when this turns red?
...
I'm doing usability testing and would like to log all user input events: mouse movements, clicks, drags, and keyboard input. I'm not having much luck figuring out how, or finding any code to do so. Any hints? I took a look at the CoreGraphics EventTap mechanisms, but I'm worried that it will be too low-level; I'd like to actually know wh...
I’m learning Cocoa programming, and I’m unable to figure out how to
archive and unarchive a custom NSView subclass
I’ve made a toy application that presents a window. This window
contains an instance of my custom BackgroundView class (archived in
the xib file). Clicking anywhere in this BackgroundView creates and
displays a blue square ...
Lets say I have an NSArrayController which contains items each with netCost and netProfit properties and I want to create a Total Percent Profit label (containing the sum of the profits divided by the sum of the costs).
In the controller class with a reference to the array controller I've attempted to do this as follows:
+ (NSSet *)key...
how to exit thread while its in running mode...when i use NSThread exit my app get hanged...
Can any one help me ? what could i use here to exit thread or close thread
Thanks Its my first post here.
...
I am creating an App and when I run it I check the Debug Pane, I am getting these errors Inside the Console:
2009-05-27 07:18:03.852 Spark[1228:10b] [ valueForUndefinedKey:]: the entity Projects is not key value coding-compliant for the key notes.
2009-05-27 07:18:09.029 Spark[1228:10b] Error setting value for key path selectionIndexPa...
I have a project that targets both Mac OS X 10.4 and 10.5, where 10.5 is the base SDK.
Some methods like -[NSString stringByReplacingOccurrencesOfString:withString] are unavailable in 10.4. I could just implement the functionality by hand. Another option would be to implement the method as a category, but that would mess with the 10.5 i...
I'm new to Objective-C and Cocoa. I've read that NSInteger and NSNumber are preferred when working with simple integers because they're the "platform-safe" versions of the primitive numeric types (and in NSNumber's case, wrapped in an object). So, I need a counter in my class that gets incremented when an NSTimer fires. On an Apple fo...
How do I change the background color of a cocoa NSBrowser from the default white? Do I need to override something else to do this? I've searched online and not found anything useful.
...
I have a little app that downloads stock prices and was working perfectly (for years) until my recent upgrade to 10.5.7. After the upgrade, the program would crash on this call:
NSString *currinfo = [NSString stringWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://finance.yahoo.com/d/quotes.csv?s=%@&f=l1c1p...
I am using a Outline view with two columns one a text field the other a check box field. Each column is binded to a NSTreeController. The problem I have is that when I click on a Checkbox I only want it to check that one check box but it checks all of them in the column. To help answer my Question this is the Bindings : http://snapplr.co...
I have a text field cell in a table view, from which I need to be made aware when it ends editing. I thought I would set my Controller class as the text field cell's delegate, and then use NSTextField's delegate method textDidEndEditing:, but realized that the text field cell doesn't seem to have delegate methods? Why is this, and what...