cocoa

Create new document programatically in cocoa

Hi!!! I'm wondering if it is possible to send a message (programatically) to a document-based application to create a new document with some special content inside it. I'm creating two applications and the first has to call the second one sending it some data. I've tried with the Apple Events but it doesn't seem to work. Thanks in adv...

Basic questions re Objective-C property syntax

I have a few basic questions regarding the syntax and usage of properties in Objective C and would appreciate it if someone could answer them please. Assume the following declaration in the header: @interface TestObject : NSObject { NSArray *myArray; } @property (nonatomic, retain) NSArray *myArray; In the implementation, can ...

Pointer to NSWindow Xib after loading it?

In my code below, CustomWindow is a subclass of NSWindow. CustomWindow *window = [[CustomWindow alloc] init]; if (![NSBundle loadNibNamed:@"NibName" owner:window]) [window center]; // doesn't work How do you get a pointer to control your XIB after you load it so you can do things such as centering the NSWindow (I mean the serialised o...

Displaying a To-Many Relationship in a Table View

I've got an application I've been working on. There are projects and employees, projects can have several employees, employees can work on several projects. Right now I want selecting a project to display which employees are related to it, and allows me to add employees I select from another full-roster list. Somehow, this has proven ...

compare a NSNumber with a fixed value?

Is there a better way to compare a NSNumber with a fixed value, it just feels a little clunky. if([myNumber isEqualToNumber:[NSNumber numberWithInt:0]]) NSLog(@"Zero"); I do know I can use -compare but it pretty much looks the same ... gary ...

NSFetchedResultsController Mac OSX Cocoa equivalent

Hi! I am porting some Core Data code from iPhone to Mac OS X. PRoblem is that Core Data Framework on Mac OS X does not have NSFetchedResultsController.h nor NSFetchedResultsControllerDelagete protocol declared. At least I am not able to force Cocoa application to see this class even if I drag Core Framework from iPhone project to link w...

Controllers in Document-based application

Hi I've tried to setup a controller for a document in a document based application, and i'm not sure what is the correct for doing that. In MyDocument.xib I have set the File's Owner as MyDocument class and the I connected the outlets and actions to it but it doesn't seem to work Could anybody give me a hand on this? Cheers ...

Do I need to release a copied NSObjects - Objective-c

Hi everyone, I was wondering if I need to release a copied NSObject? For example, I create only one dictionary that I copy into an array: Code: for (int num = 0; num < [object count]; num++) { [dictionary setObject:[object objectAtIndex:num] forKey:@"x"]; [array addObject:[dictionary copy]]; } Do I have to release the diction...

Cocoa Services Programming - How to identify whether the selected item is a folder or file wih NSFilenamesPboardType set as the send type ?

Hi , I have some queries regarding Services menu validation . I would like to enable different services provided by my app based on whether a file or folder is selected in the Finder. I have set NSFilenamesPboardType as the send type for the services . I have gone through the - (id)validRequestorForSendType:(NSString *)sendType retu...

xPath Groupings how?

OK So, I'm learning/using xpath for a basic application that's effectively ripping data off another website. I need to gain the knowledge of each persons Country/Suburb/area. In some instances you can get Australia/Victoria/Melbourne for instance. Others may just be Australia/Melbourne. Or even just Melbourne OR just Australia. So I'...

How to Parse through nsXml Parser.

Hey All, i am very new to iphone Development and i am asked to use nsxml parser to parse xml from a google api. i have parsed another url which has xml but i am not able to parse google's because it is using id's to store data rather than inside tag. i.e. <forecast_information> <city data="Anaheim, CA"/> <postal_code data="anah...

Core-Plot: Unknown class CPLayerHostingView in Interface Builder file

Using core-plot does not seem to be an easy integration task. Header path are already setup. In Interface-Builder I create an CPLayerHostingView which belongs to a View Controller which is instantiated by Interface Builder. When the nib file is loaded I get the message: Unknown class CPLayerHostingView in Interface Builder file ...

How can I work around "Xcode could not locate source file"

Hello, I'm working with the ID3 framework in Xcode (which has since disappeared off the face of the web - including google cache!). I'm testing out an import mp3 feature which allows them to edit the tags as they import them. One of the test cases is a corrupt or invalid mp3 with no proper id3 header. The problem I'm having is that whe...

NSRunAlertPanel not working in Tiger, though it works on Leopard and Snow Leopard

I'm currently using NSRunAlertPanel to display a dialog. It works perfectly in Leopard and Snow Leopard. In Tiger, it also works except for the icon. In Leopard and Snow Leopard, the icon I used for the App is displayed on the left side of the strings. This is the expected behavior. However, in Tiger, there is a big margin on the left...

How to add a scrollable NSTableView programmatically

I'm trying to add a tableview to a view in code instead of using Interface Builder and unfortunately it's causing some problems =( Here's an example of how I'm doing it now. NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame:someRect]; NSTableView *tableView = [[NSTableView alloc] initWithFrame: scrollView.bounds]; resultsT...

How do I create an NSFont that is both Bold and Italic?

This is a beginner's question about font handling in Cocoa. I have a font family, e.g. Verdana, that has the following typefaces: Regular, Bold, Italic, and Bold Italic. I know those typefaces exist since they are available in the Fonts panel. This works: NSFont *regular = [NSFont fontWithName:@"Verdana" size:75]; NSFont *bold = [NSFon...

Different cursor formats in IOFrameBufferShared

I'm reading the moust cursor pixmap data from the StdFBShmem_t structure, as defined in the IOFrameBufferShared API. Everything works fine, 90% of the time. However, I have noticed that some applications on the Mac set a cursor in a different format. According to the documentation for the data structures, the cursor pixmap format should...

How can I get a core animation Explicit animation to behave in exactly the same way as an Implicit animation?

I wish to do some custom animation using core animation but am having the (no doubt) classic problem of animations resetting when they have completed. Of course this can be stopped by using: [animation setFillMode:kCAFillModeForwards]; [animation setRemovedOnCompletion: YES]; However, I am then left with a layer that won't respond to...

How do I capture the enter key in a NSComboBox?

I have an NSComboBox embedded in the toolbar. I would like to "capture" the enter key as an event to trigger an action. I tried NSControlTextDidChangeNotification but you cant get the key that was pressed. Any help is appreciated... ...

novice needing help on shuffeling an array

Please help a TOTAL beginner.! I found this post: http://stackoverflow.com/questions/56648/whats-the-best-way-to-shuffle-an-nsmutablearray And as i try to deploy this in my own code, I cant get it working... :-( Can anyone help me to resolve this code? To me it looks like the shuffle function is not called..? here is my code: // //...