cocoa

How to take screenshot in Mac OS X using Cocoa or C++

How to take screenshot programmically of desktop area in Mac OS X ? ...

Opening a non-standard URL in a Cocoa app

In an application that I'm writing I have some code like this: NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSString* myurl = @"http://www.somewebsite.com/method?a=%d"; NSURL* url = [NSURL URLWithString:myurl]; [ws openURL:url]; The main difference being that myurl comes from somewhere outside my control. Note the %d in the URL ...

How can I use Core Animation to interpolate property values over time on my own classes?

Specifically, I am looking to use CA on properties of types other than integers and doubles CGRect, CGPoint, CGSize, and CGAffineTransform structures CATransform3D data structures CGColor and CGImage references and in objects other than CALayers or NSViews ...

When to create Interface Builder plug-in for custom view?

When do you recommend integrating a custom view into Interface Builder with a plug-in? When skimming through Apple's Interface Builder Plug-In Programming Guide I found: Are your custom objects going to be used by only one application? Do your custom objects rely on state information found only in your application? Would it be...

How do you set your Cocoa application as the default web browser?

How do you set your Cocoa application as the default web browser? I want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications (Mail, iChat etc.). ...

Can anyone recommend a complete ObjC/Cocoa or Cocoa-Touch tutorial?

I went though "Become an Xcoder", which was very useful, but it ended very abruptly, just as I started to understand about ObjC's syntax, and about Inlets/Outlets and such in Interface Builder. I've looked around, and found a bunch of tutorials that cover writing an application, but these either seem to be "Open Interface Builder, add a...

Best way to draw text with OpenGL and Cocoa?

Does anyone know an easy way to draw arbitrary text in a Cocoa NSOpenGLView? I have a couple of constraints. The text on screen may change from frame to frame (for example, a framerate display in the corner) I would like to be able to select any font installed on the system at any size ...

Creating MP4/M4A files with Chapter marks

I am trying to join together several audio files into one mp4/m4a file containing chapter metadata. I am currently using QTKit to do this but unfortunately when QTKit exports to m4a format the metadata is all stripped out (this has been confirmed as a bug by Apple) see sample code. I think this rules QTKit out for this job, but would be...

Unfiltering NSPasteboard

Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide? I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven different flavors of said RTF, everything from...

What's the Best Way to Shuffle an NSMutableArray?

If you have an NSMutableArray, how do you shuffle the elements randomly? (I have my own answer for this, which is posted below, but I'm new to Cocoa and I'm interested to know if there is a better way.) ...

How do I make a UIDatePicker display specific dates?

My application has a need to let the user choose a date from a list of dates conforming to a certain pattern. For instance, they may need to choose a monday from a list Monday's for a month. Is there a way to get a UIDatePicker to limit date choices to a certain subset or should I just use a UIPickerView? ...

Sample code for using mac camera in a program?

I'd like to use the camera in my Macbook in a program. I'm fairly language agnostic - C, Java, Python etc are all fine. Could anyone suggest the best place to look for documents or "Hello world" type code? ...

Why is my cocoa program getting EXC_BAD_ACCESS during startup?

During the load of my cocoa application, my program crashes with the messsage EXC_BAD_ACCESS. The stack trace is not helpful. Any clues to how I can find the problem? ...

How can I post a Cocoa "sheet" on another program's window?

Using the Apple OS X Cocoa framework, how can I post a sheet (slide-down modal dialog) on the window of another process? Edit: Clarified a bit: My application is a Finder extension to do Subversion version control (http://scplugin.tigris.org/). Part of my application is a plug-in (a Contextual Menu Item for Finder); the bulk of my app...

Is it safe to manipulate objects that I created outside my thread if I don't explicitly access them on the thread which created them?

I am working on a cocoa software and in order to keep the GUI responsive during a massive data import (Core Data) I need to run the import outside the main thread. Is it safe to access those objects even if I created them in the main thread without using locks if I don't explicitly access those objects while the thread is running. ...

Good ways to Learn Cocoa?

I'd love to learn Cocoa, it seems like the best systems language for Mac OS X. Can you recommend any useful ways to learn the language? Books, websites, example projects or even classes to take? ...

Dynamically hiding columns in a NSTableView

I want to dynamically hide/show some of the columns in a NSTableView, based on the data that is going to be displayed - basically, if a column is empty I'd like the column to be hidden. I'm currently populating the table with a controller class as the delegate for the table. Any ideas? I see that I can set the column hidden in Interface...

Esc and Enter keys in Cocoa dialog

How can I dismiss dialog in Cocoa application when user presses Esc or Enter key? I have OK button, is it possible to make it default button? ...

Xcode: Using a custom framework

The error I'm getting: in /Users/robert/Documents/funWithFrameworks/build/Debug-iphonesimulator/funWithFrameworks.framework/funWithFrameworks, can't link with a main executable Cliff notes: trying to include framework doesn't want to link More detail: I'm developing for a mobile device... hint, hint using Xcode and I'm trying to m...

Connecting delegate classes in Objective-C

I've got two controls in my Interface Builder file, and each of those controls I've created a separate delegate class for in code (Control1Delegate and Control2Delegate). I created two "Objects" in interface builder, made them of that type, and connected the controls to them as delegates. The delegates work just fine. My problem is, I ne...