cocoa

Make my Cocoa app respond to the keyboard play/pause key?

Is there a way to make my app respond to the play/pause button on Mac? EDIT: Using the suggested code,I get this console message: Could not connect the action buttonPressed: to target of class NSApplication Why would that be? ...

Cocoa WebView - Loding a local HTML page.

After browsing quite a bit, I still can't figure this out. I've added a HTML page and its images directory into my project Resources group in Xcode (Copied them over). When I try to load the webview with the following code, the text is displayed fine, but the images aren't loaded. NSString *path = [[[NSBundle mainBundle] resourcePath] ...

Globally hiding cursor (from background app)

I want to hide the cursor from a statusbar app and i've done some research. It seems as though the solution to this problem was found a while ago: http://stackoverflow.com/questions/1412084 or http://lists.apple.com/archives/carbon-dev/2006/Jan/msg00555.html But the code that is referred to will not compile. Do any of you guys know eit...

Why would my app not be able to "attach" an action?

I've changed my app class type from NSObject to NSApplication and now I get the following message when testing my app: Could not connect the action buttonClicked: to target of class NSApplication What does this mean and how can I fix it? ...

in scripting bridge how can i send shortcut with 2 modifiers ?

I was trying to replicate "take a screenshot shortcut" (cmd+shift+3) via cocoa and scripting bridge SystemEventsApplication * sysEvent = [SBApplication applicationWithBundleIdentifier:@"com.apple.systemevents"]; [sysEvent keyCode:20 using:SystemEventsEMdsCommandDown]; but i can't send more than one SystemEventsEMds to the method. In a...

NSWindowController view window

Hey guys, I have some questions about NSWindowController. I have a subclass of NSWindowController that has its own nib. I have another class that has an event that shows the window and loads it like so. if (!propertiesController){ propertiesController = [[WorldPropertiesController alloc] init]; } [propertiesController showWindow:sel...

QTMovie setRate problems

Hi everyone! I'm working on a program prototype that (at the current stage) just needs to be able to load a movie and adjust the playback speed. I have the UI worked out, I've gotten the playback to work, but I haven't managed to figure out how to adjust the playback speed. I believed that -[QTMovie setRate:(float)] was the way to do t...

How to find and remove unused class files from a project

My XCode project has grown somewhat, and I know that there are class files in there which are no longer being used. Is there an easy way to find all of these and remove them? ...

NSControl subclass can't read the target?

The following code: - (void) setTarget:(id)anObject { NSLog(@"anObject: %@",anObject); [super setTarget:anObject]; NSLog(@"Target: %@",[self target]); } has this output: anObject: <DropZoneViewController: 0x15dd5770> Target: (null) This is in a subclass of NSControl. So what am I doing wrong? What I'm trying to achi...

Custom dash style in NSBezierPath

Is it possible to create a custom dash style for NSBezierPath? i.e. I want a line of say, arrows all pointing in the direction of the stroke. For example, something like this... ->--->--->--->---> Any ideas appreciated.. MT ...

Extracting an image from H.264 sample data (Objective-C / Mac OS X)

Given a sample buffer of H.264, is there a way to extract the frame it represents as an image? I'm using QTKit to capture video from a camera and using a QTCaptureMovieFileOutput as the output object. I want something similar to the CVImageBufferRef that is passed as a parameter to the QTCaptureVideoPreviewOutput delegate method. For s...

Garbage Collector and Core Graphics

Hi, I'm writing a create CGImageRef from a Path method. This is: - (CGImageRef)createImage:(NSString*)path { // Create NSURL NSURL *url = [NSURL fileURLWithPath:path]; CFURLRef cfURL = (CFURLRef)url; // Create image from source CGImageRef image = NULL; CGImageSourceRef imageSource = NULL; imageSource = CGIm...

How to "Skin" an application on Mac?

I want to skin an application I wrote, but do not know where to start. Is there anything like DirectShow (stardock.com), DotNetBar etc..for Mac that I can do this? (I do know these examples are for .NET, just using a point of reference. If there is not, is there some source of information that will lead me in the right direction? A...

How can I get the monday of a week in a special date in Objective-C?

e.g. 01.10.2010 is friday => 27.09.2010 is monday. I have no idea how to manage this one. btw: how can I calculate with dates? ...

How to auto-select next row after deleting current row by core data context?

I am using Core Data to manage objects and using a NSTableView to display those objects. The table columns are binded to objects' properties through a NSArrayController. When users click the delete button, all selected objects in the NSTableView will be deleted. Then only remained objects are left in the NSTableView. This works smoothl...

NSCoding protocol question

I want to add the archiving (NSCoding) protocol to my model class, and then i implement both methods encodeWithCoder:(NSCoder*)coder and initWithCoder:(NSCoder*)coder. MyModelClass has 2 instance variables (NSString and NSImage), so i use the encodeObject:(id)object forKey:(NSString*)string method to encode the object plus the value for ...

CGScreenRegisterMoveCallback still not working?

Are Move calls still not sent by the window server, which makes registering CGScreenRegisterMoveCallback callbacks with CGScreenRegisterMoveCallback() futile? According to http://lists.apple.com/archives/quartz-dev/2008/Jan/msg00052.html this is a bug that's yet to be corrected (though it's been almost 3 years now). Is there an alterna...

Copying a file to a directory that might not be writable by the application.

I am writing an application and I am at this point at the workflow: -File A doesn't exist? -Copy file B to file A -Error? -Copy file B to file A with higher privileges The problem is in the `Copy file B to file A with higher privileges' step. I am new to asking the admin for his/her password. I'd like a window similar to this, w...

Pattern for Updating UITableView on Sync?

I'm working on a feed reader iOS project. Feed entries are listed in a UITableView in reverse chronological order. On launch, they're loaded from a database into an array. When the app syncs to feeds, it creates a new array for the new order of things, and then to update the table, compares the new array to the old array to determine wh...

Can i separate the selection model from an NSTableView

Is there any way how i can maintain my own data model of selected items in a NSTableView. I find it either pretty slow or complicated to keep the state of selected items when i update the table model. ...