cocoa

Memory management with dictionaries / possible misinterpretation by GCC?

Hi, Somewhere on my code I need to create several windows from a main window, each functioning with a specific configuration but all instances of the same controller object. I also need to keep a list of open windows, so whenever I open a window I store its instance in a dictionary and when the window is closed I send a notification to...

how to continuously display time in cocoa?

I have some code to control some buttons for an interface, but I would like to add a small text label that continuously displays time by hh:mm:ss. How do I do that? ...

Subclassing NSScroller, how to get rid of the white square in the lower right corner?

I've created an iTunes like subclass of NSScroller, however if both the horizontal and vertical scrollers are visible in an NSScrollView or NSTableView I'm left with an ugly white square in the lower right corner. Anyone has a clue on where to add my custom drawing to fill that in with something prettier? ...

Cocoa: Core Data + NSTableView

I have a core data app set up, and everything is working pretty well. But there is one little problem. When I insert a new object into my entity I have it go to my NSTableViewCell, where I can edit it to the text I want, but there's one little issue, I can edit the cell, but I can't deselect it to save it to core data, it's stuck in ed...

Wishlist for Objective-C IDE/Xcode ?

My company is evaluating the possibility of developing set of tools for Objective-C extending Xcode default functionality(basically we are thinking about providing better navigation,semantic search, more refactorings, quick fixes, improved code completion (visual assist inspired). So we would like to ask XCode/Objective-C developers: ...

Toggling a Button's state based on whether QLPreviewPanel is visible

I'm trying to create a toolbar button whose state is linked to whether the QLPreviewPanel is visible. I've tried adding adding a binding for the visible property of [QLPreviewPanel sharedPreviewPanel] but I'm running into some really odd behaviour where by observeValueForKeyPath:ofObject:change:context: is called twice once with the val...

Xcode refactoring error - "The Selection Does Not Contain Identifiable Content"

Select a method Edit > Refactor... Select "Move Up" I get the following error a lot. Any ideas on how I can get Xcode to, well, do its job? Solution Summary Option 2 that Peter suggests below did the trick. I can't believe that a) I didn't try this Smacks head and b) Xcode couldn't find a sane way of saying "Don't select th...

How can we bounce the dock icon on the Mac?

How can we bounce the dock icon of our application? ...

Coloring a Row in an NSTableView.

What I am looking to do is set the background color of the selected row in an NSTableView when a I button is clicked. I've seen other cases where people have used tableView:willDisplayCell:forTableColumn:row: and setBackgroundColor: but I don't think that will work in my situation where I want it to happen when a button is clicked. I kn...

How to draw a native looking statusitem background on a CALayer

Hi. Actually I want to draw the background of a selected NSStatusItem on the CALayer of my custom statusItemView. But since - (void)drawStatusBarBackgroundInRect:(NSRect)rect withHighlight:(BOOL)highlight does not work (?) on layers I've tried it to draw the color with the backgroundColor property. But converting the selectedMenuIte...

Parsing dirty HTML on iPhone

Hi! I already searched a long time for a good solution, but I can't find anything that fits my needs... I want to parse an HTML file and display its content in a table. Everything is almost like writing yet another RSS feed reader. Doing that by parsing valid XML files is simple and straight forward using NSXMLParser or TouchXML or lib...

How to fade my Core Animation application to a black screen first like Front Row?

How do I fade my Core Animation application to a fullscreen black screen first like Front Row? ...

What Cocoa class is this?

Hi, Can somebody please tell me which class/IB widget this is for the headers where it says "Task", "Grade", "Files"? Thanks. EDIT: My question was totally unclear. Let me rephrase. This is a screenshot from an app called "Schoolhouse". I was wondering how I can get that same style for the headers (headers being where it says "Task...

Opening a url in a non-default browser in a cocoa app

How can a cocoa application open a url in a browser other than the default browser? NSWorkspace doesn’t appear to offer any method for this. ...

Display MPEG-4 Export Component Dialog

Below is my code for a doc based QTKit app that exports to the fixed Apple device formats by way of a popUp that displays the three device options. The [NSNumberWithLong:mpg4'] option works fine as well, but it lacks custom output settings. I want to integrate the familiar QT MPEG-4 export component dialog so that the user can customize ...

Simple NSImage drawing not working as expected

This doesn't do anything: NSImage* testImage = [[NSImage alloc] initWithSize:NSMakeSize(2.0,2.0)]; [testImage lockFocus]; [[NSImage imageNamed:@"testImage"] drawAtPoint:NSMakePoint(1.0,1.0) fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; [testImage unlockFocus]; [levelView setImage:testImage]; ...but this does: [levelV...

Sorting in NSMutableArrary in iPhone

Hello, I am parsing an XML and storing all data in NSMutableArray in form of Dictionary. NSMutableArray * stories; // a temporary item; added to the "stories" array one at a time, // and cleared for the next one NSMutableDictionary * item; - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:...

cocoa objective-c for os x : get volume mount point from path

Hi I would like to find the mount point of a volume for a given NSString path. Though I'm a beginner in Cocoa and objective-C, I'm trying to do this "elegantly", ie. using one of the provided class, rather than making an external shell call or listing mounted filesystems and finding which one the path belongs to. I did find NSWorkspac...

Add events to iCal from cocoa app

Hi Is it possible to add events to iCal from my cocoa app? I tried using CalCalendarEvent but it didn't add anything to my calendar. CalCalendarStore *calStore = [CalCalendarStore defaultCalendarStore]; CalEvent *event = [CalEvent event]; CalRecurrenceRule *recRule = [[CalRecurrenceRule alloc] initYearlyRecurrenceWithInterval:1 end:[C...

How to dump CALayer into CGImageRef?

Hello, I have some custom, CoreAnimation based UI. I'd like to implement mouse dragging of certain CALayers and I'd like to stick an image of dragged layer to the cursor. The problem is, that I can't get the CALayer (which isn't image/.contents based) into an image of some kind - like CGImageRef or NSImage. Any ideas? ...