cocoa

How do I create a Cocoa GUI to edit an array of NSDate objects?

In one app I am working on I need to let the user edit a list of dates. I have those NSDate objects in an array and bound that to a NSArrayController. I bound a NSTableColumn (the only column in a table view) to that array controller using the key path arrangedObjects.self. This works fine - I get all the dates displayed in the table jus...

Saving a PDF document to disk using Quartz.

Hello, I am trying to draw a pdf page onto a pdf context and then save it to disk. I cannot seem to figure out what is wrong. Can someone give me a few pointers. Thanks. - (void)testQuartz:(NSData *)pdfDocumentData { //Create the pdf document reference CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((CFDataRef...

Subclass NSView to change background color

Hello! I want to change the background color of a custom view. I have a subclass NSView something like that: #import <Cocoa/Cocoa.h> @interface CustomBGView : NSView { NSColor myColor; } @end and the .m @implementation CustomBGView - (void)drawRect:(NSRect)rect { [myColor set]; NSRectFill([self bounds]); } ...

NSXMLDocument, nodesForXPath with namespaces

I want to get a set of elements from a xml-file, but as soon the the elements involve namespaces, it fails. This is a fragment of the xml file: <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="ht...

Showing Cocoa app's preferences on clicking app icon again

For a background app (LSUIElement=1), what's the most elegant way to make its 'preferences' or 'configuration' window pop up if a user double-clicks the app icon while it's already running? This is assuming the user cannot access the app's prefs from anywhere else (such as menu bar status item menus). I would suppose the ideal method w...

How to connect a button to a method on Mac OS X

I am used to programming for the iPhone. There, I would connect a button to an action, and then a method by creating the method like so: -(IBAction) DoStuff{…}. Then I would make an outlet for the button, and then the actual button in Interface Builder. I would then connect the button to the outlet, and then connect the button to the act...

Is there any trick to getting a WEBVIEW in OS X to goto links when you click on them?

Title says it all. I have a very very simple webview, that loads a URL that never changes, however when clicking on links, they do not load. ...

Displaying file copy progress using FSCopyObjectAsync

It appears after much searching that there seems to be a common problem when trying to do a file copy and show a progress indicator relative to the amount of the file that has been copied. After spending some considerable time trying to resolve this issue, I find myself at the mercy of the StackOverflow Gods once again :-) - Hopefully on...

How to get pointing device's coordinate on mac trackpad?

Hi I'd like to get the finger's position when user makes a gesture on the trackpad. I've already hooked on to swipeWithEvent that triggers on swipe. Within that NSEvent there's a method deltaX that reports the change of the movement. There's also absoluteX method that looks promising, but I can't get it to return anything but the follo...

What is a good tutorial for getting started with iPhone unit testing using OCUnit?

I am trying to get OCUnit to do anything on my project, but I am failing :-( Is there any good tutorial out there to get it work? Everything I find tells something different and they are all pretty complicated ... What I tried is e.g. set up a Unit Testing Target add my Target as dependency add a xxTest.m to my unit target and writ...

How can I make a NSDateFormatter accept input in one format and display it in another?

I have a table view that displays dates using a NSDateFormatter to format them using the Full date style (today would be formatted as "Friday, September 24, 2010" or in German "Freitag, 24. September 2010"). But when editing the date the formatter forces the user to type the date in the same format. How can I make the formatter accept da...

Using NSWorkspace to get all running processes

Hello. I want to get list of all running processes in MacOs. When I use [myWorkspace runningApplications]; I get only list of current user Applications. How I can find out list of all processes, with root or mysql owner. ...

Printing to a bluetooth printer using iPhone

Hey folks. I wasn't able to find a clean answer on this, is there or is there not a way to connect my iPhone to a bluetooth printer to execute some printing tasks? I'm developing the app myself, so what framework could possibly do this? i read that Apple's External Accessory Framework handles bluetooth communication, but is it possible ...

Should I use a background thread for my UI actions?

Background I've got an NSOutlineView that shows TrainingGroup entities. Each TrainingGroup represents a folder on the local machine. The NSOutlineView is bound to an NSTreeController with a fetch predicate of IsTrained == 0 Each TrainingGroup can be assigned to a project. Each TrainingGroup has many TrainingEntries that show a time wor...

Problems with an unusual NSOpenGLView setup

Hi, This is a bit long, so feel free to skip to the numbered parts if you want to avoid the lengthy intro. I'm trying to set a subclassed NSOpenGLView in an unusual way and I am running into some problems. Basically, I am writing a program to perform a bioengineering simulation for my PhD and I need to be able to compile it under both ...

CFSocket weirdness running under rosetta

I have a rather large library that negotiates communication between a server and clients. The sockets use the kCFSocketDataCallback flag to enable getting data out of the connection. The library has been working very well for a long time. Now i am trying to load it up into a PPC app that runs under rosetta on intel machines. The load goe...

Loading a Localized UIImage

I need to load localized images in my iOS app, but also have to take into account that they might need to be the ...@2x kind. How can I do this? ...

NSTokenField tokens disappear when mouse leaves non-selected NSTokenField

Weird UI bug that is exactly what is reported at this link: http://www.mail-archive.com/[email protected]/msg53307.html The tokens in my NSTokenField disappear if I move the mouse into the non selected/currently editing field and then start moving the mouse out. The tokens just flicker away. ...

Do NSSize and NSPoint work in XCode 3.2.3 when IOS is installed ?

I'm seeing some weirdity and am trying to determine - environment or me ... FWIW - I'm working through chapter 12 in Tim Isted's book. I've double & triple checked - still getting weird results - ...

Cocoa app handling a standard HTTP url scheme

I need to handle HTTP URLs that begin with a certain domain with my app, because it points to a REST source. The web service however is not under my control, so i can't easily introduce a custom url scheme to open the links with my app. Is there a way to intercept and handle such URLs in a Cocoa app? Example: http://static.domain.name/...