cocoa

Getting a list of files in a directory with a glob

For some crazy reason I can't find a way to get a list of files with a glob for a given directory. I'm currently stuck with something along the lines of: NSString *bundleRoot = [[NSBundle mainBundle] bundlePath]; NSArray *dirContents = [[NSFileManager defaultManager] directoryContentsAtPath:bundleRoot]; ..and...

Save CoreData-entities in NSUserDefaults

Imagine an CoreData entity (e.g. named searchEngine). NSManagedObjectContext manages some "instances" of this entity. The end-user is going to be able to select his "standard searchEngine" with a NSPopupButton. The selected object of NSPopupButton should be binded to the NSUserDefaults. The problem: 1) @try{save} a) If yo...

outlineView:dataCellForTableColumn:item: has strange side effect

I have an outline view delegate and am overriding outlineView:dataCellForTableColumn:item: to make the cells in my outline view into buttons (see this question). Here is the code form my delegate: - (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item; { MyCell * myCell...

How does one reproduce the inset text style when drawing text with Mac OS X Cocoa?

I'm talking about the groove style of the text on focussed title bars, or safari's bookmarks bar for example. Is there an easy way to reproduce this style when using: [string drawAtPoint:... withAttributes:...]; ...

Use setTarget: message of a cell to make the target File's Owner

I have a custom NSActionCell subclass, and I want to use setTarget: message to set it's target to File's Owner. Is there a way to get a pointer to File's Owner, or to do something to that effect? ...

NSXMLParser and error constants

Is there a description of the various errors that NSXMLParser can return? I'm aware of the apple documentation of these codes, but this page doesn't give anything other than a title for the error. ...

How do I make an OS X application react when a file, picture, etc is dropped on its dock icon?

Some applications, like Photoshop, allow users to drag a picture from a web browser, or drag a file from the filesystem, onto the application's icon in the dock. Doing this opens the file in that application. How is this done? I'd like to use Cocoa and Objective-C, but I'm interested in any solutions in any languages. ...

disabling color correction in quartz 2d

Ok, I know that it's not possible to actually disable color correction in quartz. What I'm looking for is a device-independent color space setting that dosn't change the RGB values I draw in a CGLayer. I tried all the ICC profiles from the system library, they all shift the colors. This is the best result I got: const CGFloat whitePo...

Can I use NSURLCredentialStorage for HTTP Basic Authentication?

I have a cocoa class set up that I want to use to connect to a RESTful web service I'm building. I have decided to use HTTP Basic Authentication on my PHP backend like so… <?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); //Stuff that users...

What open source Cocoa/Cocoa Touch Frameworks are out there?

I just found the Omni Group's frameworks they make available for use under a modified MIT License: http://www.omnigroup.com/developer/ The OmniDataObjects framework seems especially useful, since there is no Core Data for the iPhone. I am new to the Cocoa platform, and don't know what other useful frameworks are out there. What framew...

Multiple custom controls that use mouseMoved in one window...

At first I had one window with my custom control. To get it to accept the mouse moved events I simply put in it's awakeFromNib: Code: [[self window] makeFirstResponder:self]; [[self window] setAcceptsMouseMovedEvents:YES]; Now I'm doing something with four of them in the same window, and this doesn't work so pretty anymore. First off,...

Best practices for passing data between processes in Cocoa

I am in the middle of solving a problem which requires me to do the following in my 64-bit Cocoa application: Spawn a 32-bit Cocoa helper tool (command line tool) from within my application. This helper will open a file (a quicktime movie to be precise) and access information about that file using 32-bit only APIs (Quicktime-C APIs) T...

how to add opaque types to collections

How can I add an opaque type to a collection in cocoa? I get a compiler warning for this (obviously, because opaque types are not objects): CGColorSpaceRef colorSpace; NSArray *myArray = [NSArray arrayWithObject:colorSpace]; ...

Best way to handle multiple NSTableView(s)

What is considered the best way of handling multiple NSTableViews without using Cocoa Bindings? In my app, I have two NSTableViews that are sufficiently closely related that I'm using the same object as the delegate and dataSource for both. The problem is both tableViews invoke the same methods. I currently discriminate between the two ...

How do I add a third party Framework to iPhone project?

I am trying to use the PLDatabase framework in my iPhone app. I've added the framework to my Xcode project. However, when I run my app, it crashes with the following error: dyld: Library not loaded: @loader_path/../Frameworks/PlausibleDatabase.framework/Versions/A/PlausibleDatabase Referenced from: /Users/todd/Library/Application Supp...

NSThread crashes on second call (iPhone)

i got an object and in that object i start my thread (for loading doing some url loading) when i have a return of my data i call a selector to perform on the main thread. works fine if i call it the first time , second time it crashes ( no specific error) [NSThread detachNewThreadSelector:@selector(doThread:) toTarget:self ...

Do NSShowAllViews and NSShowAllDrawing work with XCode 3, OS X 10.5.6 ?

I am trying to enable these debugging preferences (NSShowAllViews, NSShowAllDrawing) as shown here: http://developer.apple.com/technotes/tn2004/tn2124.html#SECAPPKITVIEWS using this method: http://developer.apple.com/technotes/tn2004/tn2124.html#FIGXCODEENV Are these features present in XCode 3 and OS X 10.5.6 ? ...

What Cocoa/Core Foundation helper functions do you wish you knew about 2 years ago?

I just discovered the NSRect helper functions in NSGeometry.h (i.e. NSMidX, NSMaxX, etc...) These would have made some repetitive coding much easier. I knew about NSMakeRect, NSMouseInRect, NSOffsetRect and many others but somehow missed the functions that aid in recalculating NSRect geometry. ...

Recommend way to convert NSStrings to cstrings

I have been able to find methods like -[NSString stringWithCString:encoding:] but they do not seem to play well when the cstring is a pointer. ...

Which is easier for beginners: RubyCocoa or ObjC/Cocoa

I've heard a few debates in the past over which is more mature: RubyCocoa or Obj-C/Cocoa... but I have felt that the answers jet right over the "newbie" that would truly appreciate an answer. So the question is: for a total beginner, with little-to-no programming experience, is it easier to learn Ruby and explore Cocoa via the bridge (t...