July 2003

How to make toolbar items with a on/off state ?

I need "old style" toolbar items that keep a "pressed" state…
More...

How to retrieve the full paths of the "Applications", "Home", "Pictures", etc, folders in Cocoa ?

Is there a way ?
More...

How do you convert from a NSFileHandle to a FILE* structure?

I have a NSFileHandle but I want to use fprintf routine that need a FILE*. How to ?
More...

How to make a genie effect when a window is created/closed ?

I have a toolbar where, when some buttons are clicked, a window is opened. I would like to do this with an animation like the genie effect of the Finder: is it possible ?
More...

How to save a NSColor in a NSDictionary ?

I have tried saving an NSColor using NSDictionary and a NSUserDefaults but none of them worked.
More...

Responding to mouse click to an NSImageView...

I'm trying to respond to the user clicking in different parts of an image: NSImageView only sends the action message to my target when I drag and drop an image in to it…
More...

POSIX path to HFS ?

I have a file path from NSOpenPanel, I would like to convert it to HFS format…
More...

How to localize a Cocoa project ?

I try to copy - at the Finder level - the original English.lproj to a new one, but it doesn't work: I got errors when launching the app… ?

More...

I need my NSTextFields be able to evaluate formulas...

It would be very nice for my customers to enter math formulas in text fields, how to achieve this in Cocoa ?
More...

I want to be able to access NSDictionary objects using a key path syntax...

How to access (set and get) dictionary objects using a key path syntax like @"a.b.c." ?
More...

How to draw unaliased lines in Cocoa ?

I need unaliased hairline paths…
More...

How to prevent the opening of an Untitled document at launch ?

Is it possible to avoid the automatic opening of a new document at application startup ?
More...

How to save a NSDictionary ?

dataRepresentationOfType and loadDataRepresentation which are taing NSData arguments ?
I want to use the plist format for my application's document: how to implement
More...

How to save a NSDictionary ?

dataRepresentationOfType and loadDataRepresentation which are taing NSData arguments ?
I want to use the plist format for my application's document: how to implement
More...

I got error messages "cannot connect to target of class"

I have a document-based application. In the document window I have connected buttons to actions in the window controller, but when starting the application the AppKit seems to try to connect my buttons to my document class instead of my window controller class, what's wrong ?
More...

I got error messages "cannot connect to target of class"

I have a document-based application. In the document window I have connected buttons to actions in the window controller, but when starting the application the AppKit seems to try to connect my buttons to my document class instead of my window controller class, what's wrong ?
More...

How to get more items in "Open Recent" menu ?

I have seen applications with more then 10 items in their "Open Recent" menu, how do they do that ?
More...

I got a "file not found error"...

My program worked fine when run from PB and now I get this error…
More...

How to change the style of a NSMenuItem ?

I don't any Cocoa's metod to change the style (bold, italic, etc.) of a menu item ?
More...

Proper retain/release etiquette

please, some advice about good retain/release strategy…
More...

How to access the RGB value of a pixel in a NSImage ?

i need to read the color of a pixel in a NSImage…
More...

How to put an URL in a NSTextView ?

I need an URL in a text view like an href in an HTML page…
More...

How to add my custom struct to a NSArray ?

I try to [myArray addObject:&myStruct] and it doesn't work…
More...

How to get the name of the current print operation ?

I need the name of the print operation as displayed in the print spooler…

PMGetJobNameCFString and PMSetJobNameCFString are the two API to get and set print job name. See Apple Documentation.
 
More...

How do I enable a menu item ?

I don't understant the Cocoa way to enable/disable menu items…
More...

My Cocoa app doesn't want to run on another computer...

I give my new app to test to a friend and it doesn't work on its Mac…
More...

How to save a NSTextView in a PDF file ?

I want the user of my be able to save a text view as a PDF on disk…
More...

How to change the document's window title ?

I want to change the title of my document's window to dynamically reflect settings…

See
Apple documentation regarding - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName.
 
More...

NSSound doesn't work in a Unix tool...

I have a Cocoa Unix tool that needs to play sound but I hear nothing…
More...

How to produce good looking data report from my Cocoa app ?

I need to produce good report for my new accounting app, is there any available tool easy to integrate with Cocoa ?
More...

I want a popup menu in my table view's corner view...

How ?
More...

How to animate my dock icon ?

I want my app be able to dynamically change its dock's icon…
More...

How to copy a file from one location to another ?

What's the command to copy, move, delete, … files in Cocoa ?
More...

How to change the color of a button ?

I need an app like a Christmas tree, please help me…
More...

How to send a mail from an application ?

I need to send mail on the Net and on the local network…
More...

How to change text color of menu items ?

Is it possible to change the style and color of menu items from Cocoa ?
More...

How to insert an image in a text view ?

I need to display pictures in my text view…
More...

How to get the path to my executable ?

I need to access the system relatively to the current executable path: how ?
More...

How to make code running on different version of the OS ?

I want my app running on 10.1.x, 10.2.x, 10.3.x but there are new functions only available on some versions and not on earlier ones…
More...

What are good starter books for newbies ?

books and developer sites for newbies…
More...

How to add a perl/ruby/sh/... script to my application ?

I need to call an embedded script from my application…
More...

How to make lines of different color in my NSTableView ?

I want to make my NSTableView more user friendly by alternating or setting a specific background color for each line. How ?
More...

How to sort columns of my NSTableView ?

I want to sort some columns in my table view…
More...

I need a search field like the Apple Mail one...

If you need a text field with a small icon in it…

Look at this
Cocoa Widgets page.
More...

How to convert a number in a NSString ?

Various ways to convert a numerical value into a string using Cocoa classes…
More...

How to clip a string to a specific width ?

I need to know where (which character) a string will be clipped to a specific width…
More...

How to find an application by its OSType signature ?

NSWorkspace provides applicationForFile but this not what I a looking for…
More...

Is there a javadoc like tool for Objective-C?

I would like to generate documentation for my source files…
More...

I try to call a Unix tool from my app but don't get any output from it...

I call /usr/bin/grep from a NSTask but nothing comes out of it, even if it works from the command line…
More...

How do I add a separator item to an NSPopupButton?

[[aPopUpButton menu] addItem: [NSMenuItem separatorItem]];

That's all folks !
More...

I download a Web page with stringWithContentsOfURL but I get an older version of the page...

Why stringWithContentsOfURL does give me an old page ?

Because of Internet caches…
Use NSURLHandle class instead to download your page and call
flushCachedData in order to always get the latest updated version of the page.
More...

How to make private frameworks ?

I have some frameworks used by my app, but I don't want that the end-user install them in its Library/Framework folder…

To achieve this, you need to have access to the source and project files. Open the project in PB and set the install path to
@executable/../Frameworks, and build it.
In the project using the framework, add a Copy phase that will copy the framework into the Frameworks folder inside the application bundle.
More...

Problem declaring variables in the middle of methods

This feature stopped working. Is my PB environment corrupted ?
More...

Calling Java from Objective-C

Is it possible to call Java methods from my Cocoa application ?
More...

Warning: could not use precompiled header...

How can I fix these warnings ?

In a Terminal window enter:
sudo fixPrecomps -all
More...

How to make a Cocoa command line application ?

If you need a Cocoa application that acts mainly as a daemon but it some circumstances show up some GUI or need access to the AppKit framework…
More...

NSTimer doesn't fire in a Foundation tool

I want to use NSTimer in a Foundation tool but is doesn't work. What am I doing wrong ?
More...

Problem declaring variables in the middle of methods

This feature stopped working. is my PB environment corrupted ?
More...