cocoa

How to only auto resize certain NSTableColumn?

I have a table with 3 columns (NSTableColumn) build with XCode IB. The last column is "Amount" and the column before it is "Description. When I resize the window, the table will be resize as well but the "Amount" is the column that gets span wider. How do I fixed the "Amount" column width and instead auto resize the "Description" colu...

App modal NSPanel / sheet / dialog + NSThread == window hangs ??

I'm in the midst of debugging an extremely unusual problem, and I was wondering if anybody might have any insight into what might be going wrong: In a controller class from a NIB, I take an NSPanel from that same NIB, and then show it app modally on an NSWindow (that was created by hand in code): [[NSApplication sharedApplication] begi...

Problem with NSDocument and writeToURL:ofType:error:

I'm working on a document-based application, and I want to use a document package as my file format. To do that, it seems that the NSDocument method I need to override is -writeToURL:ofType:error:. It sometimes works, but only under certain conditions. For example, this code works: - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSStri...

How to use performSelector:withObject:afterDelay: on a method with multiple arguments

Let's say I have a method with this signature: -(void)plotPoly:(Polygon *)poly WithColor:(UIColor *)color AndFill:(BOOL)filled; How do I get that UIColor and BOOL in there as well as the Polygon? Should I wrap them in a NSArray and pull them out inside the called method? That would mean I have to change the method sig, right? Is th...

Cocoa and Cocoa Touch: is an object on the dictionary?

I thought it would be simpler to find if an object in on a dictionary, but it appears it is not. I have a NSMutableDictionary with just one key named "products". I have several products added to the dictionary dynamically, using something like [myDict addObject:@"banana" forKey:@"products"]; [myDict addObject:@"orange" forKey:@"produc...

A simple way to generate tones / sine waves on mac? (ruby would be nice)

I'm writing a program that involves playing back sine waves and combinations of sine waves... it must run on Mac, and I'm looking for a simple API that I can use. I'm open to ObjC, C, C++, Ruby, Python, etc.... I don't care what language as long as it's just a few lines of code. But Ruby would be nice :-) On Linux you can write to /dev/...

How to get the list of all announced bonjour services on all available domains?

It's not the problem to look in all domains, but I can't find the right way to look for any service on the network. ...

When get the swf address, how to show the flash with the flashplayer again?

I used the cocoa of MAC to develop a plugin with safari , I used the method is : changed the plugin's MIME TYPES is application/x-shockwave-flash and extensions is swf, so when safari lanched , it will add my plugin , but Now have a problem : when the safari page showing , the swf embed it don't show , because I don't know the method of...

Drag and drop .app files into NSImageView and get the file path.

Hi, I have an NSWindow containing and NSImageView. I want that the user can drag 'n drop a .app file (application) into the NSImageView, and my application see which file is dropped. Is there a way to do this (okay, I'm sure there is a way to do this -_- but which one :p )? So much like iWeb does it with image files. A tutorial would ...

Converting audio and video to NSData

I would like to confirm what the recommended ways are to convert audio and video files into NSData objects. Is + dataWithContentsOfFile: the best way to do this? Thank you ...

Sending a Selector to another Class. And Creating an Instance of A Class.

How would I send a Selector to another class? I know to send it to a selector in the same file you do [self performSelector:@selector(doSomething)]; and for sending it to another class I've tried [otherClass performSelector:@selector(doSomethingElse)]; But I just get an error in the Debugger saying +[otherClass doSomethingElse]:...

Consolidate annotations on a zoomed MKMapView

There are a number of bad ways to go about what I want to do, but this seems like one of those cases of "there must be a better way". I am using an MKMapView in an iPhone app that displays a number of annotations. Pretend for conceptual discussion that each town in a US state has an annotation, so there's a fairly dense pile of annotati...

Finding duplicates in an NSMutableArray

I have a class (colorClass) which holds 2 NSStrings (idNumber and favoriteColor). There is an NSMutableArray (arrayColor) that holds over 50,000 colorClass objects. What is the fastest way to find all duplicate idNumbers from all colorClass objects and return them in an array? Right now I'm using 1 for loop that goes copies arrayColor...

Cocoa-Bindings : Update NSObjectController manually?

In my little cocoa application I have bound the properties of a class to some text fields with help of a NSObjectController. The only problem I have so far: you always have to leave a text field before the NSObjectController updates the class with the current input. This becomes a problem if the user doesn't leave a texfield and clicks ...

A good way to create a shortcut selection field for use in a Mac app?

I need to have a way for the user to input a shortcut key combination in my Preferences and I'm looking to do something that works similar to how the System Preferences keyboard shortcut panel works. I thought about subclassing an NSTextField and override keyDown: and keyUp: but it seems these overrides do nothing... any hints? Altern...

Cocoa API Image Manipulation

Is there any way to do simple image manipulation like adjusting brightness, contrast, exposure, etc. using Cocoa? Something like NSImage? ...

Gradient Scale - Cocoa

Hi all, How would I write a code that would set the gradient level to 50%? It's pretty straight forward, but I'm not using an NSSlider so it just needs to be dropped down to 50% or anywhere around there. Thanks Kevin ...

Setting up relationships while importing core data?

I have an in memory managed object context called importMoc that I use to import records (e.g. employees). I have parsed a file and set up the employee objects in importMoc with one very important exception. The user confirms they want to process %d employees but I can't quite figure out how or when to set the "parent" relationship of th...

How should I construct an NSDictionary with multiple keys?

I have a situation where I want to map a pair of objects to a dictionary of information. I'd like to avoid creating an NSDictionary of NSDictionaries of NSDictionaries since that's simply confusing and difficult to maintain. For instance if I have two classes, Foo and Bar, I want {Foo, Bar} -> {NSDictionary} Are there other options th...

Quick Multiplication Question - Cocoa

Hi there, I'm still learning, and I'm just stuck. I want the user to enter any number and in result, my program will do this equation: x = 5*y (y is the number the user adds, x is outcome) How would I do this? I'm not sure if I'm suppose to add in an int or NSString. Which should I use, and should I enter anything in the header file...