cocoa

How to Duplicate an AppleScript function in Objective-C?

This AppleScript code gives the name of files that have been dropped onto the script. How do I do the same in an Objective-C app? Would an application written in Objective-C be able to boot the JAR file using the file name as an argument to JAR? on open of theFiles -- Executed when files are dropped on the script set fileCount to (...

Does NSString Support Non-Standard/Non-English characters?

I am using an xml parser to populate an array. This string: 'Calle Mare de Déu de' generates an exception at [NSPlaceholderString initwithstring:]. On Snow Leopard (10.6) it reports a nil argument while on Leopard (10.5) it throws an exception but reports no error. When I replace the string 'Calle Mare de Déu de' with 'Calle Mare de Deu...

Cocoa: what is the var name of an instance created by a NIB file?

When a Cocoa NIB file instantiates an instance of a custom controller object, what is the name of the variable that that custom controller instance is assigned to? In case that isn't clear, if you manually created an instance of that class you would do: MyControllerClass *myVar = [[MyControllerClass alloc] init]; What equivalent of "...

Xcode completion doesn't recognize the type of my variable

I'm creating an object with: NSMenu *appMainMenu = [[NSMenu alloc] initWithTitle:@"MyApp"]; (Ignore the fact I'm creating this menu programmatically and not using a Nib File. I understand the disadvantages of doing so) The menu appears correctly in the menubar. However, when I try to call any instance method such as: [appMainMenu...

Why does one have to use CALayer's presentationLayer for hit-testing?

I was working on a Cocoa Touch application, and trying to handle touches by determining which sublayer of a view's layer was touched. My controller's code looked like this: CALayer *hitLayer = [self.view.layer hitTest:point]; This wasn't working. It would work if I tapped at the bottoms of sublayers, but not at the tops. After an hour...

Reading Data from File in Objective-C

Hello, I want to read the string after delimiter from a text file in Objective-C.i'm stil struggling to get it :(.... This is wat i ve done til nw, but when i print the contents of databuffer in line 7 in code below, the data read is returning encapsulated in an NSData object.How to convert it into Readable format? NSData *databuffer;...

Objective-C++ Memory Problem

Hello, I'm having memory woes. I've got a C++ Library (Equalizer from Eyescale) and they use the Traversal Visitor Pattern to allow you to add new functionality to their classes. I've finally figured out how it works, and I've got a Visitor that just returns the properties from one of the objects. (since I don't know how they'r...

Cocoa View Template

In IB, there is a Cocoa View Template that creates a xib without any type of window. I have looked in the docs and can't seem to find how this is useful. You can't just load a xib without a window. Well, you can but it doesn't show anything. Does anybody know how to use a View Xib without a window? Can it be used as a popupmenu? ...

simple record and play application!

Hi all, I am trying to make a simple application which will store the sound said by user , say on click of record button and will play it back to him/her , say on click of play button. Can anyone suggest me some appropriate way to do this ?? Thanks, Miraaj ...

Spreadsheet-like application using Core Data?

I'm working on an application which big part will be a spreadsheet-like view (with numeric values despite of columns' and rows' names). Is there any sense in using Core Data in such a case? I'm worrying about efficiency since I know that Core Data doesn't natively support arrays and I don't feel relationships would fit very well in my ca...

Cocoa: what creates the instance of a controller class linked to a NIB file?

This is a question about the inner workings of Cocoa NIB files and the supporting framework classes for them. For a handy example, please take a look at the Apple Currency Calculator tutorial: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/01Introduction.html If you open the MainMenu.n...

Validating input in NSOpenPanel accessory view

I would like to solicit additional information from the user during the NSOpenPanel but need to validate that information before the open panel completes. For example, I may want to allow the user to add a note about the file in the open panel selection but need to validate that that comment is not empty. I have an accessory view whose ...

Drawing a NSImage into NSView subclass

Here's my code so far (in the draw rect): // Drawing code here. NSLog(@"%@", [[NSBundle mainBundle] pathForResource:@"NoiseBGMainView" ofType:@"jpg"]); NSURL *pathToBGImage = [[NSURL alloc] initWithString:[[NSBundle mainBundle] pathForResource:@"NoiseBGMainView" ofType:@"jpg"]]; NSImage *NoiseBGMainView = [[NSImage alloc] initWithConten...

Is it possible to NOT embed fonts in a PDF generated with PDFKit?

I'm generating PDF documents with PDFKit and I'd like to have it not embed the standard PDF fonts (Times, Helvetica, Courier) if possible. Is there a way to accomplish this? ...

Looking for popUpMenuPositioningItem:atLocation:inView: equivalent for 10.5

I'm working on an application that needs to display a context menu on screen in various scenarios. In the function I'm writing, I don't have access to any NSWindows or NSViews. I'd like to use popUpMenuPositioningItem:atLocation:inView as this function works perfectly for me in 10.6. However, we have a requirement to support 10.5, so thi...

Debugging Nested NSCollectionViews

I'm not really sure how to start debugging this issue. I've got an NSCollectionView, whose NSCollectionViewItem prototype view itself contains an NSCollectionView (as well as an NSArrayController, to provide content to this 2nd-level collection view). Both levels of collection view work fine when the top-level view is in the main nib. ...

iPhone Core Data: Cascading delete across a many-to-one relationship

I have two classes A and B with a many-to-one relationship from A to B (multiple A objects may reference the same B). The question is, if the delete rule on the A side is Cascade, will B be deleted only when the last referencing A is deleted or will it be deleted the first time an associated A is deleted. The delete rule for the B side...

NSTableView with multiple columns

What is an easy way to set up my NSTableView with multiple columns to only display certain data in one column. I have the IBOutlets set up, but I don't know where to go from there. ...

NSWindow Examples

What are some good NSWindow examples ? I want to start out by writing a simple program that has a window and 2 buttons. Clicking on each button loads a new window in the same view and displays the options. Another option I am considering is a tabbed view where user clicks on tabs and that window loads. I could not find any good tutorial...

Is there any way to automatically generate @property and @dynamic tags for Core Data primitive accessors?

Update: mogenerator works, with a template modification The Core Data documentation suggests using the -primitiveValue and -setPrimitiveValue: methods to access and change internal data of an NSManagedObject subclass rather than the slower and non-type-checked -primitiveValueForKey: and setPrimitiveValue:forKey:. I would like to adopt ...