cocoa

Is there a good charting library for iPhone?

I have a need to render and display charts (bar charts for now, but more types may be needed later) in an iPhone app I'm working on. I've done some looking around and it doesn't look like there are any really good, mature charting libraries for iPhone yet. I've also looked for something written for Cocoa on the Mac that can be adapted, b...

What's the accepted way to implement export functionality in a document-based Cocoa app?

I have a simple document-based Cocoa app that acts as a viewer for .wav files, to do a bit of frequency analysis. I'd like to be able to export the data gleaned from opened files to CSVs for further analysis in other programs. The document-based application framework in Cocoa lets you override - (NSData *)dataOfType:(NSString *)typeNam...

How can I safely write to a given file path in Cocoa, adding a numeric suffix if necessary?

We want to write to "foo.txt" in a given directory. If "foo.txt" already exists, we want to write to "foo-1.txt", and so on. There are a few code snippets around that try and answer this question, but none are quite satisfactory. E.g. this solution at CocoaDev uses NSFileManager to test if a path exists to create a safe path. However, t...

Cocoa / Objective-C Array beyond bounds question

I am playing with a little Cocoa Apps I wrote where I add objects of a class Person to a NSMutableArray. When I try to access an object that is beyond the array limit all I get is an "beyond bounds" message on the console. In fact I expected something worse. I expected the app to crash! But it doesn't. I am not sure if this is a good o...

Running python code from standard Cocoa application

I have an XCode project built as a Cocoa single document application (it's not a Python-Cocoa application, that is not what I want). All the documentation I found assumes I want to create a Cocoa application with code written in Python and this is not the case - I want a standard Cocoa application that calls a method out of a Python cla...

KVO and Bindings problems using my own (not the shared) NSUserDefaults object

I'm subclassing NSUserDefaults in my application. A side effect of this is I can't use [NSUserDefaults sharedUserDefaults], I have to have a class method to provide my own static defaults object. This isn't been a problem in code, but it's proving tricky now that I'm hooking up the preferences UI with bindings. The shared NSUserDefaults...

inserting various views into UIScrollView

Hi: we're trying to implement an article detail view for an RSS-like application. The windows has a UIScrollView that contains a UITextView (which is the title), a UIButton (which opens a gallery), and a UIWebView (with the body). The idea is that all these elements scroll together... The problem is that whenever we have a body over 1...

Make a firefox plugin out of Cocoa application?

My friend wants me to turn his Cocoa application into a firefox plugin. The application takes the URL of the site where the data is to be downloaded from, and downloads it, taking the load off of the browser. My question is, since firefox plugins are written in javascript (I think), and the application is written in objective C, is this ...

How would you make a checkbox delete a row in a table if checked (Cocoa) ?

My App Uses Coredata and Displays Data in a table, one column has a checkbox and one has the title. What i want it to do is that when the checkbox gets checked it deletes the row instead of people having using the Remove/Minus button. The reason I want this is because my app is a Task Management app. ...

What data type do I use for an integer in SOAP XML in Cocoa?

I imagine it is just an int, but I want to verify. Thanks Corey ...

Multiple-line cursor movements in XCode

I'd like to map a key to move the cursor in the XCode up by ten lines. Of course, I want another one to move down too. The key mapping would ideally be something like 'Control-Alt-P'. Is there a way to achieve this in XCode without resorting to Automator? Ashley has the answer below, the formatting was a little different as the pro...

Maximum length of [NSXMLNode stringValue]

Hello all, I have an XML document which contains an element that is over 90,000 characters in length*. NSXMLNode* node = ...; NSString* val = [node stringValue]; // this is not the full contents of the node! The second line only gives me 80k or so. This is obviously not what I want, so I'd appreciate some suggestions. Is NSXMLNode b...

Disable undo for creation/deletion of NSManagedObject

In my Core Data model, I've got a relationship called listItems which links to several listItem entities, each with a stringValue attribute. I've created a control which is essentially a list of NSTextFields, one for each list item. The control is bound to listItems properly, and I've set it up so that pressing the return key creates a n...

Why is the text stretching in a Text Field in a Split View?

When I adjust the size of the text field using a divider, if the text is not selected it stretches like this. ...

How do I find all the property keys of a KVC compliant Objective-C object?

Hello, Is there a method that returns all the keys for an object conforming to the NSKeyValueCoding protocol? Something along the lines of [object getPropertyKeys] that would return an NSArray of NSString objects. It would work for any KVC-compliant object. Does such a method exist? I haven't found anything in searching the Apple docs ...

add NSTimeInterval to NSDate in cocoa

I've got a NSDate that represents a specific time. The format of that date is hhmmss. I want to add an NSInterval value (specified in seconds) to that time value. Example: NSDate = 123000 NSTimeInterval = 3600 Added together = 133000 What is the best way to do this? Thanks. ...

UINavigationController Auto-Rotation to Landscape does not update UIView frame

I'm working on an application that operates entirely in landscape mode (UIStatusBarHidden=YES and UIInterfaceOrientation=UIInterfaceOrientationLandscapeRight). I'm using a NavigationController, with my rootViewController (MainViewController) setup like this: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac...

How to signal an NSStreamEventEndEncountered on an NSInputStream reading from NSMutableData.

In Cocoa, I've setup two NSThreads, one producer and one consumer. The producer appends data to an NSMutableData, and the receiver opens an NSInputStream from that data and reads in chunks. The producer thread writes a lot faster than the consumer processes, which is OK. But the producer only produces a finite amount of work, then exits...

Cocoa: Learn currently selected keyboard layout / input language

Hello! How do I learn currently selected keyboard layout / input language? I was playing with NSInputManager but wasn’t able to achieve anything. [NSInputManager currentInputManager] returns (null) (as reported with %@) and thus [[NSInputManager currentInputManager] localizedInputManagerName] It would be the best for me to just g...

How to implement a multi-platform multimedia application?

On which technological basis would you implement a multimedia app, which has to meet the following requirements: Platforms: Windows XP/Vista, Mac OS X, Linux (nice to have) Should play audio (mp3) and video (H.264 would be great) from local disk I looked into things like Cocotron which is a cross-platform Objective-C API similar to C...