cocoa

Application Design - Differences between iPhone and Cocoa applications?

In iPhone development for every page you see there are 2 files, a nib file, and a view Controller (books.nib, booksViewController.m), but in a Cocoa application apple suggests to have 3 files (books.nil, books.m, booksViewController). What is the point of having 2 class files? is it a bad idea to connect the attributes to the outlets in ...

core data and undo errors plus no redo...

So the issue: I drop a some items into an editor area it creates an undo grouping...under the covers, as the whole process of dropping the items is actually a collection of tasks. If I then delete the tasks, I am given an option to undo the delete. If I do this undo I get an error in the console: _endUndoGroupRemovingIfEmpty:: NSUndoMa...

NSTableView drag items "count badge"

When you start dragging items in the table view in Mail or iTunes, you see this count badge neatly showing (in a red "starred" circle, or rounded rectangle if the count gets big enough) the number of dragged items. Is there a ready-made code somewhere available for me to do this? Because if it is, it could save me a whole lot of time wri...

Slow down playback speed?

How can I slow down an audio file (for playback only) on Mac OS X, but preserve good quality? I tried using QTKit to slow down audio but the quality is bad. Edit: I'm using this code: QTMovie *audio = [[QTMovie alloc] initWithFile:mediaClipURL error:&error]; // ... (error handling) [audio setRate:0.5]; ...

Placing items from a Core Data entity into an NSOutlineView programmatically?

Sorry if this seems like a silly question - I am an amateur when it comes to Objective-C and Cocoa and even less knowledgable when it comes to Core Data usage. So here's the situation: I have an NSOutlineView that I've already populated with a few items manually with an NSTreeController. What I need to do now is take the items in one of...

Registering for a NSFileHandleReadToEndOfFileCompletionNotification

Hello kind ladies and gentlemen :) I'm trying to figure out how to make this piece of code from a previous question work, but I'm stuck on the part on how to 'register' a NSFileHandleReadToEndOfFileCompletionNotification. This is my code: NSTask *topTask = [NSTask new]; [topTask setLaunchPath:@"/usr/bin/top"]; [topTask setArguments:[N...

NSObjectController problem with overridden valueForKeyPath method

hello! i have next situation: I have own controller ( myController : NSObjectController ) an overridden method -(id)valueForKeyPath in it for bind my attributes. And I have some method like -(BOOL)canRemove; I want to button 'Enable' to -(BOOL)canRemove; but can't. It must like bind button 'Enable' to canAdd of NSController. I sink ...

Draw part of CGImage

I have an application that draws images from a CGImage. The CImage itself is loaded using a CGImageSourceCreateImageAtIndex to create an image from a PNG file. This forms part of a sprite engine - there are multiple sprite images on a single PNG file, so each sprite has a CGRect defining where it is found on the CGImage. The problem i...

Custom control in NSCollectionViewItem

I want to put a custom control inside the view for my NSCollectionViewItem. Lets say I have a custom NSView called BoxesView.BoxesView is just a view that draws a predetermined number of boxes in its view. That number of boxes is set in the init method. Lets say I set it to 8. When I load up the collection view, all the other controls ...

how to convert lower case character to upper case?

unichar c; c = [myString characterAtIndex:0]; unichar catchcar = [c lowercaseString]; error : invalid reciever type unicar. I know lowercaseString is used to covert String not character. Is there any solution? ...

OS X transparent panels in Qt?

Is there a way to create a transparent panel as described by the Apple Human Interface Guidelines in Qt 4.6 (built for OS X 10.6/Cocoa)? If not, are there any alternatives similar in look and function? I understand that Qt is a cross platform toolkit, but I want my application to feel as »native« as possible… ...

NSTextView inside an NSScrollView doesn't scroll :(

I have the following code in a stand-alone Cocoa test app: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSView *contentView = [window contentView]; NSTextStorage *textStorage = [NSTextStorage new]; NSLayoutManager *layoutManager = [NSLayoutManager new]; NSTextContainer *textContainer = [NSText...

NSPredicate with functions or selectors

I have a lot of people NSManagedObjects that I need filtering and was hoping to do it within the initial fetch instead of filtering the array afterwards. I've used selectors in predicates before, but never when fetching NSManagedObjects, for example I have all my employees and then i use this predicate on the NSArray... [NSPredicate pre...

Finding out the NSTextField for a field editor.

I' using - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject to provide my own field editor so i can display a custom context menu. This works but when inside the "menuForEvent:" method of my field editor, how can i find to which NSTextField it is attached? EDIT: okay i found that i get it via inside the Text...

How to create a topmost overlay which ignores mouse clicks, etc.

I'd like to know how to setup a transparent overlay windown in Cocoa which can ignore mouse clicks (so that they pass through to whatever window is below). The user should not be able to interact with the window with their mouse. ...

Set cursor position in Mac OS

Hi, I want to write a little vnc similar program that moves the Mac OS cursor to a position (x, y) given through a protocol which gets data from Bonjour service. The problem is that I don't know how to move the cursor! I'm working with Cocoa. Thanks for help! ...

NSURLErrorDomain -999 breaks Flash

I have a WebView which works great except in one instance. When it loads a page with a SWF that loads another SWF, the load delegate gets "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" From what I gather, this error happens when a second request is made before the first has completed (1, 2, 3, 4). I am not express...

How can i create a transparent and non rectangular NSWindow with Cocoa?

I want to create a windows style error popup for my Cocoa application like this one Is there any tutorial how to do this? Or can somebody give me at least the names of a few API functions that i need to check out. ...

Memory managment question

I have a button with IBAction, which shows another window: -(IBAction)someButtonClick:(id)sender { anotherView = [[NSWindowController alloc] initWithWindowNibName:@"AnotherWindow"]; [anotherView showWindow:self]; } I worry about memory management in here. I allocate an object in this IBAction and don't released it. But how ca...

Retieve the document name during Save operation of document based application

I have a document based application. I have overridden dataOfType function to save the appliation. However I am unable to retrieve the application name given by user in NSSavePanel while saving. Is there a way I can get the application name. Also which function is invoked after dataOfType is invoked which can be overridden ...