cocoa

How would you make a text cell in a an Outline View show how many children the parent row has?

How would you make Rows that are the Top Parent in an Outline View (which is connected to a NSTreeController) display how many children it has in a Text Cell? If this is a bit confusing here is a Picture of what I mean. I am talking about the number to the right of one of the rows in the circle, which is displaying how many childre...

Read only "N" bytes from a file in Cocoa

How to read only "N" bytes from a specified file? ...

Cocoa MySQL Framework pointers and/or advice?

Hey, I'm looking to find a good MySQL framework for Cocoa that I can use in my XCode projects to access a database on the web. Do you know of any good, open source/free ones? I have looked at http:// mysql-cocoa.sourceforge .net/index.html but haven't had a chance to play with it. Should I start there or is there something better? Tha...

Using NSProxy and forwardInvocation:

Hi, I would like to code a proxy that forwards method invocations to another object over TCP without NSConnection and NSDistanceObject stuff. What I want is my own protocol. The problem is that subclassing NSProxy and overriding forwardInvocation: is not sufficient. I have also to override methodSignatureForSelector Here is my questio...

Garbage Collection Crash using NSImage

This piece of code was split off from a project I am working on. It consistently reproduces a garbage collection error on my Mac OS 10.5.7 and sometimes crashes. I have been looking at it for too long so my question is: does anybody else see why this would give errors when garbage collection is on? - (void) doCrash: (id) sender { NS...

Should I worry about collisions in NSUserDefaults?

In the application I'm working on, I'm generating a username and password and storing them in [NSUserDefaults standardUserDefaults]. I know there's some system-wide information you can retrieve from there; does that mean all the applications on the phone have access to everything in there? I'm currently prefixing the keys I'm using in th...

How does one get the error message from compileAndReturnError?

I've seen plenty of examples on how to use NSAppleScript, e.g.: NSAppleScript *script = = [[NSAppleScript alloc] initWithSource:source]; NSDictionary *errorDict; if ( ![script compileAndReturnError:&errorDict] ) { // ... } But I've never seen any example code that does anything with errorDict. In my case, I'd like to extract the ...

Does NSString stringWithCString: length: retain the byte array I pass in?

I'm working with AsyncSocket where the the AsyncSocket object calls a delegate method below whenever it receives data from remote end: - (void)onSocket:(AsyncSocket*)socket didReadData:(NSData*)data withTag:(long)tag; Now, within this method, I pass the NSData object into the following command to get a NSString representation of the ...

CoreData - how to create a subclass of a subclass of NSManagedObject (Generation Gap pattern)

I'm sure this must be a stupid question, but I've scoured the interwebbings and can't find the answer. Plenty of people talk about using the Generation Gap pattern, in which you have an NSManagedObject subclass that is generated from your model, and then subclass that to add transient properties and behaviours. The benefit of this is tha...

how to new a nib file in xcode 3.0?

I want to create a new nib file in the xcode 3.0 , but I found that I can create the xib file only , why ? ...

Mac OS X View Swapping

I am developing an application which has an image and some buttons whose position remain unchanged during the entire flow. So I subclassed the NSViewController. This is the main view of my application with the fixed buttons and image. I add an NSBox item into which various subviews will be displayed and swapped in/out. How do I display t...

How would you make a Status Item show or Hide a window when clicked?

How would make a Status Item when the actually button is clicked in the Menu Bar not in a drop down menu show or hide a window? Sorry if this is a bit vague. ...

How would you make a checkbox in a Outline View become checked when all it's children's checkbox's are checked?

How would you make a checkbox which is on a parents/groups row in an outline view become checked when all it's children's checkbox's are checked. But when only some are checked display a line. Here is an example of what I'm talking about: ...

NSPopUpButtonCell inside custom NSCell does not change selection when item is selected from menu

I have an NSPopUpButtonCell inside a custom NSCell and I'm using - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView to produce the pop up menu when it's clicked. I have also overridden copyWithZone: in my custom cell to copy the popUpCell instance variable so that each row in my table view has its own pop up ce...

How do I use a dynamically load library in a command line utility?

Possible Duplicate: using frameworks in a command line tool Hey, I've written a command line 'foundation tool' that uses the RegexKit.framework extensively. Everything works when run in Xcode but if I compile the release build and try to run it in Terminal I get the following error: dyld: Library not loaded: @executable_path/....

After selecting item in NSPopUpButtonCell inside custom NSCell table view must be refocused

I have an NSPopUpButtonCell inside a custom NSCell which is being used in an NSTableView. I'm using - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView to pop up the pop up menu when it is required. The problem is that after an item is selected from the menu the table view seems to lose focus, such that it must...

How do I deselect all cells in an NSBrowser

How do I deselect/unselect any selected cells in an NSBrowser? ...

how to open a panel with new folder function by NSOpenPanel ?

By default , we use the NSOpenPanel class method to open a open panel: -beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo: But I find that some software can open the open panel with new folder button , inculde the XCode , how to get it ? Thanks a lot! ...

I want to allocate memory for 700 MB to 800 MB Image size

I am trying to allocate memory NSImage*originalLocationImage; NSURL *fileURL = [NSURL fileURLWithPath:originalLocation]; //originalLocation is file path in my disk originalLocationImage = [[NSImage alloc]initByReferencingURL:fileURL]; NSBitmapImageRep *sourceRep = [[NSBitmapImageRep alloc]initWithData:[SourceImage TIFFRepresentation...

Connect to Sharepoint through Cocoa

Hi, how do I connect to Sharepoint (e.g. fetching lists) through Cocoa? Is there any blog post or document about it? Regards, Stefan ...